From 72911f5b3cf0424e1d27e01abfc79150cc29a97e Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Mon, 28 Oct 2013 16:18:58 +0400 Subject: [PATCH] [FIX] add O_CLOEXEC while opening logfile This prevents our logfile from being written by the traced application (it is bad because it has no permissions to write to our logfile). Change-Id: Ifa5f097d050cb0d80eaee8097bf10abd5734a4c9 Signed-off-by: Nikita Kalyazin --- daemon/da_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/da_debug.c b/daemon/da_debug.c index 33089c9..b4af13d 100644 --- a/daemon/da_debug.c +++ b/daemon/da_debug.c @@ -42,7 +42,8 @@ #if DEBUG void initialize_log() { - int fd = open(DEBUG_LOGFILE, O_WRONLY | O_CREAT | O_TRUNC, 0777); + int fd = open(DEBUG_LOGFILE, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, + 0777); if (fd > 0) { dup2(fd, 1); dup2(fd, 2); -- 2.7.4