chiark / gitweb /
server/admin.c (a_init): Abort if we can't set socket permissions.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 14 Mar 2012 19:22:14 +0000 (19:22 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 14 Mar 2012 21:09:26 +0000 (21:09 +0000)
I don't think sending a message to trace really captures the severity
of the situation adequately.

server/admin.c

index 7aa1678d33143cb90b21d1dafc06f08e00e36330..32b35772fc52788792859a3c63b2974b690f6e5a 100644 (file)
@@ -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);