git.samba.org
/
mat
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9f4c3da
)
pidfile: use set_close_on_exec()
author
Andrew Tridgell
<tridge@samba.org>
Wed, 30 Nov 2011 04:18:54 +0000
(15:18 +1100)
committer
Andrew 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
patch
|
blob
|
history
diff --git
a/source4/smbd/pidfile.c
b/source4/smbd/pidfile.c
index 71a203b73e947824d62b69064627bae0213d773d..85a6322ff70123b0bca1c77cc7e95f81d0640013 100644
(file)
--- 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)));