s3-pidfile: set the close on exec flag for the created pidfiles.
authorGünther Deschner <gd@samba.org>
Mon, 17 May 2010 16:22:37 +0000 (18:22 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 18 May 2010 14:16:19 +0000 (16:16 +0200)
Guenther

source3/lib/pidfile.c

index 2c52d12122060735d29b13bd0e31d5b316da8ddc..a3e39db7848382dfcf85bba17179d551eade14eb 100644 (file)
@@ -145,6 +145,9 @@ void pidfile_create(const char *program_name)
        }
        /* Leave pid file open & locked for the duration... */
        SAFE_FREE(name);
+
+       /* set the close on exec so that we don't leak the fd */
+       fcntl(fd, F_SETFD, FD_CLOEXEC);
 }
 
 void pidfile_unlink(void)