[Title] fix is_same_app_process function
authorgreatim <jaewon81.lim@samsung.com>
Tue, 25 Jun 2013 06:22:38 +0000 (15:22 +0900)
committergreatim <jaewon81.lim@samsung.com>
Tue, 25 Jun 2013 06:24:22 +0000 (15:24 +0900)
[Desc.]
[Issue]

Change-Id: If43c0bea6b1f3213ee7fabf7ac1fe697c65aa9dc

daemon/threads.c
daemon/utils.c
packaging/dynamic-analysis-manager.spec

index 26cd7ce..f83f6c5 100644 (file)
@@ -133,6 +133,10 @@ static void* recvThread(void* data)
                        LOGI("EXTRA MSG %d|%d|%s\n", log.type, log.length, log.data);
                        continue;
                }
+//             else if(log.type == MSG_LOG)// && log.data[0] == '1' && log.data[1] == '3')
+//             {
+//                     LOGI("%dclass|%s\n", log.data[0] - '0', log.data);
+//             }
 #ifdef PRINT_TARGET_LOG
                else if(log.type == MSG_LOG)
                {
index 7de644b..5926793 100644 (file)
@@ -336,7 +336,6 @@ int get_manifest_path(const char* exec_path, char* buf, int buflen)
 int exec_app(const char* exec_path, int app_type)
 {
        pid_t pid;
-       char command[PATH_MAX];
        char appid[PATH_MAX];
 
        if (exec_path == NULL || strlen(exec_path) <= 0) 
@@ -667,12 +666,20 @@ int get_app_base_address(int *baseAddress)
 int is_same_app_process(char* appPath, int pid)
 {
        int ret = 0;
+       int tlen;
        FILE *fp;
        char buf[BUFFER_MAX];
        char cmdPath[PATH_MAX];
-       char execPath[PATH_MAX];
+       char tPath[PATH_MAX];
+
+       strcpy(tPath, appPath);
+       tlen = strlen(tPath);
+       if(strcmp(tPath + tlen - 4, ".exe") == 0)
+       {
+               // remove .exe from tPath
+               tPath[tlen - 4] = '\0';
+       }
 
-       get_executable(appPath, execPath, PATH_MAX);
        sprintf(cmdPath, "/proc/%d/cmdline", pid);
 
        if((fp = fopen(cmdPath, "r")) == NULL)
@@ -682,12 +689,14 @@ int is_same_app_process(char* appPath, int pid)
 
        if(fgets(buf, BUFFER_MAX, fp) != NULL)
        {
-#ifdef RUN_APP_LOADER
-               if(strcmp(buf, appPath) == 0)
-#else
-               // use execPath instead of manager.appPath
-               if(strcmp(buf, execPath) == 0)
-#endif
+               tlen = strlen(buf);
+               if(strcmp(buf + tlen - 4, ".exe") == 0)
+               {
+                       // remove .exe from tPath
+                       buf[tlen - 4] = '\0';
+               }
+
+               if(strcmp(buf, tPath) == 0)
                        ret = 1;
                else
                        ret = 0;
index 8c17120..3219e80 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dynamic-analysis-manager
 Summary:    dynamic analyzer manager
-Version:    2.1.2
+Version:    2.2.0
 Release:    1
 Group:      System/Libraries
 License:       Apache License, Version 2