diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-11-30 15:18:54 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-12-15 23:36:22 +0100 |
commit | fae42c1f41435bf087c23d384cd6147dd9f7f4ef (patch) | |
tree | 86b57d78646f07e6058d66be0566cf9f79704588 | |
parent | 9f4c3da734adbabf457074563f3fb3fae7b85585 (diff) | |
download | samba-fae42c1f41435bf087c23d384cd6147dd9f7f4ef.tar.gz samba-fae42c1f41435bf087c23d384cd6147dd9f7f4ef.tar.bz2 samba-fae42c1f41435bf087c23d384cd6147dd9f7f4ef.zip |
pidfile: use set_close_on_exec()
this prevents a fd leak to child processes
-rw-r--r-- | source4/smbd/pidfile.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c index 71a203b73e..85a6322ff7 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))); |