From: Mark Wooding Date: Wed, 14 Mar 2012 19:22:14 +0000 (+0000) Subject: server/admin.c (a_init): Abort if we can't set socket permissions. X-Git-Tag: 1.0.0pre11~36 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/commitdiff_plain/9e0161ce6242483f0400c561014ea8bf12df6d45 server/admin.c (a_init): Abort if we can't set socket permissions. I don't think sending a message to trace really captures the severity of the situation adequately. --- diff --git a/server/admin.c b/server/admin.c index 7aa1678d..32b35772 100644 --- a/server/admin.c +++ b/server/admin.c @@ -2275,11 +2275,13 @@ again: close(fd); goto again; } - chmod(sun.sun_path, 0600); + if (chmod(sun.sun_path, 0600)) { + die(EXIT_FAILURE, "failed to set socket permissions: %s", + strerror(errno)); + } if (chown(sun.sun_path, u, g)) { - T( trace(T_ADMIN, - "admin: failed to give away socket: %s", - strerror(errno)); ) + die(EXIT_FAILURE, "failed to set socket owner: %s", + strerror(errno)); } umask(omask); fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC);