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 7aa1678..32b3577 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);