summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-06-08 11:37:31 -0500
committerBryce Harrington <bryce@osg.samsung.com>2015-07-16 19:28:36 -0700
commit6bc33d63cfc0799b85a8e62c3657b5a13de5a78a (patch)
treee78a6c2806bb3b3df82f20c4d77275296149a7b8 /src
parent4a8a3a1c710b3d2cb795c96bd811c0484c2b497f (diff)
log: Open log file CLOEXEC so child processes don't get the fd
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/log.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 535bcba8..0302c8ca 100644
--- a/src/log.c
+++ b/src/log.c
@@ -36,6 +36,8 @@
#include "compositor.h"
+#include "os-compatibility.h"
+
static FILE *weston_logfile = NULL;
static int cached_tm_mday = -1;
@@ -77,8 +79,11 @@ weston_log_file_open(const char *filename)
{
wl_log_set_handler_server(custom_handler);
- if (filename != NULL)
+ if (filename != NULL) {
weston_logfile = fopen(filename, "a");
+ if (weston_logfile)
+ os_fd_set_cloexec(fileno(weston_logfile));
+ }
if (weston_logfile == NULL)
weston_logfile = stderr;