Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jan 2014 09:19:59 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260471 - head/sbin/casperd
Message-ID:  <201401090919.s099JxdI049049@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Thu Jan  9 09:19:59 2014
New Revision: 260471
URL: http://svnweb.freebsd.org/changeset/base/260471

Log:
  Always create /var/run/casper with correct permissions and don't depend on the
  calling process' umask.
  
  Submitted by:	Mikhail <mp@lenta.ru>

Modified:
  head/sbin/casperd/casperd.c

Modified: head/sbin/casperd/casperd.c
==============================================================================
--- head/sbin/casperd/casperd.c	Thu Jan  9 09:16:35 2014	(r260470)
+++ head/sbin/casperd/casperd.c	Thu Jan  9 09:19:59 2014	(r260471)
@@ -541,6 +541,7 @@ main_loop(const char *sockpath, struct p
 	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 p
 	    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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401090919.s099JxdI049049>