[FIX] msg_start parsing error for already runnig app 66/51866/2
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Mon, 16 Nov 2015 15:20:27 +0000 (18:20 +0300)
committerVitaliy Andreevich <v.cherepanov@samsung.com>
Tue, 17 Nov 2015 09:02:33 +0000 (01:02 -0800)
error if PID=""
if PID is "" we should instrument all applications

Change-Id: I2e1ff602f1d31d5832d8859ca47a97027e4d0beb
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
daemon/cpp/inst/AppInstRunning.h

index 12d60cd..23d2a90 100644 (file)
@@ -41,8 +41,12 @@ public:
 private:
     int doInit()
     {
-        if (!str2pid(info().id().c_str(), _pid)) {
-            LOGE("[%s] error convert 'app ID to pid'\n", type2str(AT_RUNNING));
+        const char *pid_st = info().id().c_str();
+        if (pid_st[0] == '\0') {
+                /* if pid is empty string we should instrument all applications */
+                _pid = 0; /* posible it is not good idea set 0 */
+        } else if (!str2pid(pid_st, _pid)) {
+            LOGE("[%s] error convert 'app ID to pid' <pid=%s>\n", type2str(AT_RUNNING), pid_st);
             return -EINVAL;
         }