From: Andrew Tridgell Date: Wed, 30 Nov 2011 04:18:54 +0000 (+1100) Subject: pidfile: use set_close_on_exec() X-Git-Tag: tevent-0.9.15~730 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=fae42c1f41435bf087c23d384cd6147dd9f7f4ef;p=ddiss%2Fsamba.git pidfile: use set_close_on_exec() this prevents a fd leak to child processes --- diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c index 71a203b73e9..85a6322ff70 100644 --- a/source4/smbd/pidfile.c +++ b/source4/smbd/pidfile.c @@ -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)));