[FIX] add O_CLOEXEC while opening logfile
authorNikita Kalyazin <n.kalyazin@samsung.com>
Mon, 28 Oct 2013 12:18:58 +0000 (16:18 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Mon, 28 Oct 2013 13:06:07 +0000 (17:06 +0400)
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 <n.kalyazin@samsung.com>
daemon/da_debug.c

index 33089c9..b4af13d 100644 (file)
@@ -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);