set close-on-exec flag on errorlogfile
Make sure the file descriptor is closed within the child after forking. Signed-off-by: Michael Walle <michael@walle.cc>
This commit is contained in:
parent
6ce2f4d394
commit
8adcf3e5d1
@ -16,6 +16,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#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");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user