[FIX] prevent 18/30018/1 Tizen_SDK_2.3
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 7 Nov 2014 11:13:39 +0000 (15:13 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 7 Nov 2014 11:13:39 +0000 (15:13 +0400)
Change-Id: I09a05a7b78feb30055732a611b85f2283ac06cf9
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
daemon/da_debug.c

index 9437bbb7ce03a1f7c24d1e34e01fef486e5ce992..8ce2452ed01a738b28d1680ee9d867d9405c38cf 100644 (file)
@@ -86,7 +86,9 @@ int initialize_log(void)
        int fd = -1;
        int fd_null = -1;
 
-       remove(DEBUG_LOGFILE);
+       if (remove(DEBUG_LOGFILE))
+               LOGE("remove(%s), return error, errno=%d\n",
+                    DEBUG_LOGFILE, errno);
 
        fd = open(DEBUG_LOGFILE, O_WRONLY | O_CREAT | O_TRUNC, 0777);
        fd_null = open("/dev/null", O_WRONLY | O_CREAT | O_TRUNC, 0777);
@@ -102,8 +104,12 @@ int initialize_log(void)
                close(2);
        }
 
-       close(fd_null);
-       close(fd);
+       if (fd_null == -1)
+               close(fd_null);
+
+       if (fd == -1)
+               close(fd);
+
        close(0);
        return ret;
 }