pidfile: use set_close_on_exec()
authorAndrew Tridgell <tridge@samba.org>
Wed, 30 Nov 2011 04:18:54 +0000 (15:18 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 15 Dec 2011 22:36:22 +0000 (23:36 +0100)
this prevents a fd leak to child processes

source4/smbd/pidfile.c

index 71a203b73e947824d62b69064627bae0213d773d..85a6322ff70123b0bca1c77cc7e95f81d0640013 100644 (file)
@@ -107,6 +107,8 @@ void pidfile_create(const char *piddir, const char *name)
                exit(1);
        }
 
+       set_close_on_exec(fd);
+
        if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==false) {
                DEBUG(0,("ERROR: %s : fcntl lock of file %s failed. Error was %s\n",  
               name, pidFile, strerror(errno)));