[FIX] remove (clean) log file on daemon start 51/29751/1
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Mon, 3 Nov 2014 19:48:28 +0000 (22:48 +0300)
committerVitaliy Cherepanov <v.cherepanov@samsung.com>
Mon, 3 Nov 2014 19:49:38 +0000 (22:49 +0300)
Change-Id: I9de7720f7eb454ea7bd3769e4ffcaa5104f2b35a
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
daemon/da_debug.c

index 45e5ded..9437bbb 100644 (file)
@@ -83,8 +83,13 @@ int initialize_log(void)
         *
         */
        int ret = 0;
-       int fd = open(DEBUG_LOGFILE, O_WRONLY | O_CREAT | O_TRUNC, 0777);
-       int fd_null = open("/dev/null", O_WRONLY | O_CREAT | O_TRUNC, 0777);
+       int fd = -1;
+       int fd_null = -1;
+
+       remove(DEBUG_LOGFILE);
+
+       fd = open(DEBUG_LOGFILE, O_WRONLY | O_CREAT | O_TRUNC, 0777);
+       fd_null = open("/dev/null", O_WRONLY | O_CREAT | O_TRUNC, 0777);
 
        if (fd != -1 && fd_null != -1) {
                if (close_on_exec_dup(fd_null, 1) != 0 ||