Otherwise, for example, the file descriptor for the main PID file will
leak all the way down to event scripts.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12898
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
#include <talloc.h>
+#include "lib/util/blocking.h"
+
#include "common/pidfile.h"
struct pidfile_context {
goto fail;
}
+ if (! set_close_on_exec(fd)) {
+ close(fd);
+ ret = EIO;
+ goto fail;
+ }
+
pid_ctx->fd = fd;
lck = (struct flock) {