diff options
author | pjd <pjd@FreeBSD.org> | 2014-01-09 09:19:59 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2014-01-09 09:19:59 +0000 |
commit | efe626246bec4643d3b7813f372c733a071e5240 (patch) | |
tree | b65809ca7868fa770907ba9f1d27bead9e8695b6 /sbin | |
parent | bee988f08499a20c1029a4c8d9330000cb800c9e (diff) | |
download | FreeBSD-src-efe626246bec4643d3b7813f372c733a071e5240.zip FreeBSD-src-efe626246bec4643d3b7813f372c733a071e5240.tar.gz |
Always create /var/run/casper with correct permissions and don't depend on the
calling process' umask.
Submitted by: Mikhail <mp@lenta.ru>
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/casperd/casperd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/casperd/casperd.c b/sbin/casperd/casperd.c index d0e6376..f283709 100644 --- a/sbin/casperd/casperd.c +++ b/sbin/casperd/casperd.c @@ -541,6 +541,7 @@ main_loop(const char *sockpath, struct pidfh *pfh) struct casper_service *casserv; struct service_connection *sconn, *sconntmp; int lsock, sock, maxfd, ret; + mode_t oldumask; lsock = socket(AF_UNIX, SOCK_STREAM, 0); if (lsock == -1) @@ -554,8 +555,10 @@ main_loop(const char *sockpath, struct pidfh *pfh) sizeof(sun.sun_path)); sun.sun_len = SUN_LEN(&sun); + oldumask = umask(S_IXUSR | S_IXGRP | S_IXOTH); if (bind(lsock, (struct sockaddr *)&sun, sizeof(sun)) == -1) pjdlog_exit(1, "Unable to bind to %s", sockpath); + (void)umask(oldumask); if (listen(lsock, 8) == -1) pjdlog_exit(1, "Unable to listen on %s", sockpath); |