From: Mark Wooding Date: Wed, 14 Mar 2012 19:18:07 +0000 (+0000) Subject: server/admin.c (a_init): Restore the old umask after creating the socket. X-Git-Tag: 1.0.0pre11~37 X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/commitdiff_plain/879483d731fd208ca5339118a5e5420daf654b28 server/admin.c (a_init): Restore the old umask after creating the socket. --- diff --git a/server/admin.c b/server/admin.c index 228cce15..7aa1678d 100644 --- a/server/admin.c +++ b/server/admin.c @@ -2226,6 +2226,7 @@ void a_init(const char *name, uid_t u, gid_t g) struct sockaddr_un sun; struct sigaction sa; size_t sz; + mode_t omask; /* --- Create services table --- */ @@ -2243,7 +2244,7 @@ void a_init(const char *name, uid_t u, gid_t g) /* --- Attempt to bind to the socket --- */ - umask(0077); + omask = umask(0077); again: if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) die(EXIT_FAILURE, "couldn't create socket: %s", strerror(errno)); @@ -2280,6 +2281,7 @@ again: "admin: failed to give away socket: %s", strerror(errno)); ) } + umask(omask); fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC); if (listen(fd, 5)) die(EXIT_FAILURE, "couldn't listen on socket: %s", strerror(errno));