Update SMACK rule & logging system.
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 28 May 2013 00:45:23 +0000 (09:45 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 29 May 2013 04:47:12 +0000 (13:47 +0900)
[model] Tizen
[binary_type] AP
[customer] Tizen Developers
[issue#] N/A
[problem] Overwriting log file.
[cause] Every slave provider uses same filename for logging.
[solution] Use different filename for each provider using their PID.
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I1cf127e2485cb584c46bc2a5474237c78b58aeb6

org.tizen.data-provider-slave.rule
packaging/org.tizen.data-provider-slave.spec
src/critical_log.c

index ba3d8bb..863d089 100644 (file)
@@ -20,3 +20,4 @@ org.tizen.data-provider-slave pkgmgr::db rw
 org.tizen.data-provider-slave sys-assert::core rwxat
 e17 org.tizen.data-provider-slave rwx
 dbus org.tizen.data-provider-slave rwx
+org.tizen.data-provider-slave sound_server rw
index 1f0e614..8fce55e 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: org.tizen.data-provider-slave
 Summary: Plugin type livebox service provider.
-Version: 0.11.3
+Version: 0.11.4
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index df32238..2e59b61 100644 (file)
@@ -57,10 +57,10 @@ static inline void rotate_log(void)
 
        s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
 
-       namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 20;
+       namelen = strlen(s_info.filename) + strlen(SLAVE_LOG_PATH) + 30;
        filename = malloc(namelen);
        if (filename) {
-               snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, s_info.filename);
+               snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, s_info.filename, getpid());
 
                if (s_info.fp)
                        fclose(s_info.fp);
@@ -81,17 +81,11 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...)
 {
        va_list ap;
        int ret;
-       struct timeval tv;
 
        if (!s_info.fp)
                return LB_STATUS_ERROR_IO;
 
-       if (gettimeofday(&tv, NULL) < 0) {
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               tv.tv_sec = 0;
-               tv.tv_usec = 0;
-       }
-       fprintf(s_info.fp, "%d %lu.%lu [%s:%d] ", getpid(), tv.tv_sec, tv.tv_usec, util_basename((char *)func), line);
+       fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
 
        va_start(ap, fmt);
        ret = vfprintf(s_info.fp, fmt, ap);
@@ -120,7 +114,7 @@ HAPI int critical_log_init(const char *name)
                return LB_STATUS_ERROR_MEMORY;
        }
 
-       namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 20;
+       namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 30;
 
        filename = malloc(namelen);
        if (!filename) {
@@ -130,7 +124,7 @@ HAPI int critical_log_init(const char *name)
                return LB_STATUS_ERROR_MEMORY;
        }
 
-       snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, name);
+       snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, name, getpid());
 
        s_info.fp = fopen(filename, "w+");
        if (!s_info.fp) {