merge patch code of tizen2.0 branch submit/trunk/20130108.024856
authorgiyeol.ok <giyeol.ok@samsung.com>
Tue, 8 Jan 2013 02:48:28 +0000 (11:48 +0900)
committergiyeol.ok <giyeol.ok@samsung.com>
Tue, 8 Jan 2013 02:48:28 +0000 (11:48 +0900)
Signed-off-by: giyeol.ok <giyeol.ok@samsung.com>
packaging/system-server.spec
ss_device_change_handler.c
ss_launch.c
ss_mmc_handler.c
ss_predefine.c
ss_procmgr.c

index cce057e..2775d68 100755 (executable)
@@ -1,7 +1,7 @@
 #sbs-git:slp/pkgs/s/system-server system-server 0.1.51 56e16bca39f96d6c8aed9ed3df2fea9b393801be
 Name:       system-server
 Summary:    System server
-Version: 0.1.59
+Version: 0.1.60
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    Flora Software License
index b9aed3f..5b84a0d 100755 (executable)
@@ -83,7 +83,8 @@ static int check_lowbat_charge_device(int bInserted)
                                bChargeDeviceInserted = 0;
                                //low bat popup during charging device removing
                                if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &bat_state) == 0) {
-                                       if(bat_state < VCONFKEY_SYSMAN_BAT_NORMAL) {
+                                       if (bat_state < VCONFKEY_SYSMAN_BAT_NORMAL ||
+                                           bat_state == VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF) {
                                                bundle *b = NULL;
                                                b = bundle_create();
                                                if(bat_state == VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF)
index 1474004..a295dde 100644 (file)
@@ -76,11 +76,11 @@ static int parse_cmd(const char *cmdline, char **argv, int max_args)
        char *buf, *bufp;
        int nargs = 0;
        int escape = 0, squote = 0, dquote = 0;
-       int bufsize = strlen(cmdline)+1;
+       int bufsize;
 
        if (cmdline == NULL || cmdline[0] == '\0')
                return -1;
-
+       bufsize = strlen(cmdline)+1;
        bufp = buf = malloc(bufsize);
        if (bufp == NULL || buf == NULL)
                return -1;
index e48abb8..0b2f561 100644 (file)
@@ -48,9 +48,10 @@ int get_mmcblk_num()
        }
        chdir("/sys/block");
 
-       while (dir = readdir(dp)) {
+       while ((dir = readdir(dp)) != NULL) {
                memset(&stat, 0, sizeof(struct stat));
-               lstat(dir->d_name, &stat);
+               if (lstat(dir->d_name, &stat) < 0)
+                       continue;
                if (S_ISDIR(stat.st_mode) || S_ISLNK(stat.st_mode)) {
                        if (strncmp(".", dir->d_name, 1) == 0
                            || strncmp("..", dir->d_name, 2) == 0)
@@ -63,7 +64,7 @@ int get_mmcblk_num()
                                if (fd == -1) {
                                        PRT_TRACE_ERR("%s open error: %s", buf,
                                                      strerror(errno));
-                                       return -1;
+                                       continue;
                                }
                                r = read(fd, buf, 10);
                                if ((r >= 0) && (r < 10))
index 346cd97..59adf86 100644 (file)
@@ -83,7 +83,7 @@ static TapiHandle *tapi_handle = NULL;
 static void make_memps_log(char *file, pid_t pid, char *victim_name)
 {
        time_t now;
-       struct tm *cur_tm;
+       struct tm cur_tm;
        char params[4096];
        char new_log[NAME_MAX];
        static pid_t old_pid = 0;
@@ -94,26 +94,21 @@ static void make_memps_log(char *file, pid_t pid, char *victim_name)
        old_pid = pid;
 
        now = time(NULL);
-       cur_tm = (struct tm *)malloc(sizeof(struct tm));
-       if (cur_tm == NULL) {
-               PRT_TRACE_ERR("Fail to memory allocation");
-               return;
-       }
 
-       if (localtime_r(&now, cur_tm) == NULL) {
+       if (localtime_r(&now, &cur_tm) == NULL) {
                PRT_TRACE_ERR("Fail to get localtime");
                return;
        }
 
        PRT_TRACE("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
-                pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
-                cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
-                cur_tm->tm_sec);
+                pid, (1900 + cur_tm.tm_year), 1 + cur_tm.tm_mon,
+                cur_tm.tm_mday, cur_tm.tm_hour, cur_tm.tm_min,
+                cur_tm.tm_sec);
        snprintf(new_log, sizeof(new_log),
                 "%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
-                pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
-                cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
-                cur_tm->tm_sec);
+                pid, (1900 + cur_tm.tm_year), 1 + cur_tm.tm_mon,
+                cur_tm.tm_mday, cur_tm.tm_hour, cur_tm.tm_min,
+                cur_tm.tm_sec);
 
        snprintf(params, sizeof(params), "-f %s", new_log);
        ret = ss_launch_evenif_exist(MEMPS_EXEC_PATH, params);
@@ -128,7 +123,6 @@ static void make_memps_log(char *file, pid_t pid, char *victim_name)
                        fclose(fp);
                }
        }
-       free(cur_tm);
 }
 
 static int lowmem_get_victim_pid()
index b8e474b..2d57ff3 100755 (executable)
@@ -162,7 +162,7 @@ int check_and_set_old_backgrd()
                        continue;
                }
                oom_adj = atoi(buf);
-               if (oom_adj >= OOMADJ_BACKGRD_UNLOCKED) {
+               if (oom_adj < MAX_BACKGRD_OOMADJ && oom_adj >= OOMADJ_BACKGRD_UNLOCKED) {
                        pid_t *bucket = buckets[oom_adj];
                        for (i = 0; i < LIMITED_BACKGRD_NUM; i++) {
                                if (!bucket[i])