summaryrefslogtreecommitdiff
path: root/source3/lib/pidfile.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-05-17 18:22:37 +0200
committerGünther Deschner <gd@samba.org>2010-05-18 16:16:19 +0200
commit20537d65166714f083256cf4f48b96d35786253a (patch)
treecabe0d011a23a99329eef04b4e0bcbae33c45878 /source3/lib/pidfile.c
parentd6a73ad85bff4867b48d12fa68479812f682ec0a (diff)
downloadsamba-20537d65166714f083256cf4f48b96d35786253a.tar.gz
samba-20537d65166714f083256cf4f48b96d35786253a.tar.bz2
samba-20537d65166714f083256cf4f48b96d35786253a.zip
s3-pidfile: set the close on exec flag for the created pidfiles.
Guenther
Diffstat (limited to 'source3/lib/pidfile.c')
-rw-r--r--source3/lib/pidfile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c
index 2c52d12122..a3e39db784 100644
--- a/source3/lib/pidfile.c
+++ b/source3/lib/pidfile.c
@@ -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)