Code sync
[apps/native/starter.git] / src / lockd-debug.c
old mode 100755 (executable)
new mode 100644 (file)
similarity index 63%
rename from lock-mgr/src/lockd-debug.c
rename to src/lockd-debug.c
index bff5949..69545de
@@ -1,18 +1,20 @@
-/*
- * Copyright 2012  Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *  http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+ /*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.0 (the "License");
+  * you may not use this file except in compliance with the License.
+  * You may obtain a copy of the License at
+  *
+  *     http://www.tizenopensource.org/license
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+
+
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -26,7 +28,7 @@
 #include "lockd-debug.h"
 
 #define LINEMAX 256
-#define MAXFILELEN     1048576
+#define MAXFILELEN     1048576 /* 32000 */
 #define LOGFILE "/tmp/starter.log"
 
 void lockd_log_t(char *fmt, ...)
@@ -44,7 +46,8 @@ void lockd_log_t(char *fmt, ...)
        time_t current_time = 0;
        bzero((char *)&debugString, LINEMAX);
        time(&current_time);
-       gmtime_r(&current_time, &local_t);
+       /* local_t = gmtime(&current_time); */
+       gmtime_r(&current_time, &local_t);      /* for prevent 53555 */
        int len = snprintf(debugString, sizeof(debugString),
                           "[%d-%02d-%02d, %02d:%02d:%02d]: ",
                           local_t.tm_year + 1900, local_t.tm_mon + 1,
@@ -57,10 +60,13 @@ void lockd_log_t(char *fmt, ...)
        }
        len = g_strlcat(debugString, buf, LINEMAX);
        if (len >= LINEMAX) {
+               /* TODO:ERROR handling */
                return;
        } else {
                debugString[len] = '\n';
        }
+       /* FIXME this is for permission.. later we should fix and remove this... */
+       /* system("chmod 666 "LOGFILE); */
        if ((fd = fopen(LOGFILE, "at+")) == NULL) {
                LOCKD_DBG("File fopen fail for writing Pwlock information");
        } else {
@@ -74,6 +80,7 @@ void lockd_log_t(char *fmt, ...)
                                execl("/bin/rm", "rm", "-f", LOGFILE,
                                      (char *)0);
                        }
+                       /* system("rm -rf "LOGFILE);  */
                } else {
                        fseek(fd, 0l, SEEK_END);
                        fileLen = ftell(fd);
@@ -85,6 +92,7 @@ void lockd_log_t(char *fmt, ...)
                                        execl("/bin/rm", "rm", "-f", LOGFILE,
                                              (char *)0);
                                }
+                               /* system("rm -rf "LOGFILE); */
                        } else
                                fclose(fd);
                }