From: Michael Walle Date: Sat, 1 Oct 2011 00:29:30 +0000 (+0200) Subject: set close-on-exec flag on errorlogfile X-Git-Tag: 4.1~131^2^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8adcf3e5d102647e9cc6c4cce7e6d0c7a9f3a9bb;p=i3%2Fi3 set close-on-exec flag on errorlogfile Make sure the file descriptor is closed within the child after forking. Signed-off-by: Michael Walle --- diff --git a/src/log.c b/src/log.c index d424ffd3..5e1c35eb 100644 --- a/src/log.c +++ b/src/log.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "util.h" #include "log.h" @@ -41,6 +43,9 @@ void init_logging() { } errorfile = fopen(errorfilename, "w"); + if (fcntl(fileno(errorfile), F_SETFD, FD_CLOEXEC)) { + ELOG("Could not set close-on-exec flag\n"); + } } /*