ubusd: use umask of 0177 for now to prevent a world- and group-writable unix socket
[project/ubus.git] / ubusd.c
diff --git a/ubusd.c b/ubusd.c
index 03215b3..59dee3e 100644 (file)
--- a/ubusd.c
+++ b/ubusd.c
@@ -12,6 +12,7 @@
  */
 
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/uio.h>
 #include <signal.h>
 #include <stdio.h>
@@ -321,6 +322,7 @@ int main(int argc, char **argv)
        }
 
        unlink(ubus_socket);
+       umask(0177);
        server_fd.fd = usock(USOCK_UNIX | USOCK_SERVER | USOCK_NONBLOCK, ubus_socket, NULL);
        if (server_fd.fd < 0) {
                perror("usock");