Browse Source

+ pidfiles are now always created with 0644 perms instead if LOGFILE_MASK (0600)

Denis Ovsienko 12 years ago
parent
commit
7593fddfa1
2 changed files with 10 additions and 3 deletions
  1. 6 0
      lib/ChangeLog
  2. 4 3
      lib/pid_output.c

+ 6 - 0
lib/ChangeLog

@@ -1,3 +1,9 @@
+2007-10-04 Denis Ovsienko
+
+	* pid_output.c: (pid_output) stop using LOGFILE_MASK
+	  (0600 by default), introduce and use PIDFILE_MASK (0644)
+	  instead.
+
 2007-09-18  Paul Jakma <paul.jakma@sun.com>
 
 	* privs.c: definition of ZCAP_NET_ADMIN on Solaris should

+ 4 - 3
lib/pid_output.c

@@ -25,6 +25,7 @@
 #include <log.h>
 #include "version.h"
 
+#define PIDFILE_MASK 0644
 #ifndef HAVE_FCNTL
 
 pid_t
@@ -36,7 +37,7 @@ pid_output (const char *path)
 
   pid = getpid();
 
-  oldumask = umask(0777 & ~LOGFILE_MASK);
+  oldumask = umask(0777 & ~PIDFILE_MASK);
   fp = fopen (path, "w");
   if (fp != NULL) 
     {
@@ -67,8 +68,8 @@ pid_output (const char *path)
 
   pid = getpid ();
 
-  oldumask = umask(0777 & ~LOGFILE_MASK);
-  fd = open (path, O_RDWR | O_CREAT, LOGFILE_MASK);
+  oldumask = umask(0777 & ~PIDFILE_MASK);
+  fd = open (path, O_RDWR | O_CREAT, PIDFILE_MASK);
   if (fd < 0)
     {
       zlog_err("Can't create pid lock file %s (%s), exiting",