Fix coding rule violation and add app_name in usbhost_get_contents not to reuse app_pid 89/196489/2 accepted/tizen/unified/20190103.030314 submit/tizen/20181231.121810
authorlokilee73 <changjoo.lee@samsung.com>
Mon, 31 Dec 2018 07:38:36 +0000 (16:38 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Mon, 31 Dec 2018 08:04:23 +0000 (17:04 +0900)
Change-Id: If6efdb9d3f94fc9361e3f702c4ea3fea592a11d3
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/common/macro.h
src/crash/crash.c
src/launcher/app.c
src/usb/usb-device.c

index 2d1b0dea77cc2446ce61dc4333e7386813076bc2..e299ca00996452c209fc88bd8c5c11a06c2ebd3a 100644 (file)
 
 
 /* App to launch a popup on a notification */
-#define SYSTEM_SIGNAL_SENDER                   "org.tizen.system-signal-sender"
-#define SIGNAL_SENDER_TYPE                     "_SIGNAL_TYPE_"
-#define SIGNAL_SENDER_TYPE_RECOVERY            "recovery-popup"
-#define SIGNAL_SENDER_TYPE_USBSTORAGE_UNMOUNT  "usbstorage-unmount-popup"
-#define SIGNAL_SENDER_TYPE_COOLDOWN            "cooldown"
-#define SIGNAL_SENDER_TYPE_ENCRYPT             ODE_ENCRYPT
-#define SIGNAL_SENDER_TYPE_DECRYPT             ODE_DECRYPT
-#define SIGNAL_SENDER_TYPE_ODE_UG              "ode-setting-ug"
-#define SIGNAL_SENDER_DEVICE_PATH              "_DEVICE_PATH_"
-#define SIGNAL_SENDER_ERROR_TYPE               "_ERROR_TYPE_"
-#define SIGNAL_SENDER_MEMORY_SPACE             "_MEMORY_SPACE_"
+#define SYSTEM_SIGNAL_SENDER                           "org.tizen.system-signal-sender"
+#define SIGNAL_SENDER_TYPE                             "_SIGNAL_TYPE_"
+#define SIGNAL_SENDER_TYPE_RECOVERY                    "recovery-popup"
+#define SIGNAL_SENDER_TYPE_USBSTORAGE_UNMOUNT          "usbstorage-unmount-popup"
+#define SIGNAL_SENDER_TYPE_COOLDOWN                    "cooldown"
+#define SIGNAL_SENDER_TYPE_ENCRYPT                     ODE_ENCRYPT
+#define SIGNAL_SENDER_TYPE_DECRYPT                     ODE_DECRYPT
+#define SIGNAL_SENDER_TYPE_ODE_UG                      "ode-setting-ug"
+#define SIGNAL_SENDER_DEVICE_PATH                      "_DEVICE_PATH_"
+#define SIGNAL_SENDER_ERROR_TYPE                               "_ERROR_TYPE_"
+#define SIGNAL_SENDER_MEMORY_SPACE                     "_MEMORY_SPACE_"
 
 /* ODE */
 #define ODE_ENCRYPT "encrypt"
index 342b0235fd15a252d49e4a279d83a96c15e3e90c..56d3c5f3bae9720ef752d0108e1ed54ec1879af5 100644 (file)
@@ -87,7 +87,7 @@ out:
 
        snprintf(tname, len, "%s", name);
        free(name);
-       _D("get_app_name() is finished");       
+       _D("get_app_name() is finished");
        return 0;
 }
 
index 8ba4ec724b35ab7209668db88690362e3010a623..98ac05ba0c9d2b3a96c5083e6bcc24ca22e42afc 100644 (file)
@@ -31,9 +31,8 @@ static int launch_app(char *appname,
                return -EINVAL;
 
        b = bundle_create();
-       if (!b) {
+       if (!b)
                return -ENOMEM;
-       }
 
        if (key1 && value1) {
                ret = bundle_add(b, key1, value1);
index bd4f93176ecbc9a4bd8ebb74c6d434bf75ee3a6d..e19326958637bb766a7edd9f64e34a67dd6d1565 100644 (file)
@@ -140,7 +140,7 @@ static void usbhost_confirm_cancel_clicked(void *data, Evas_Object *obj, void *e
 static int usbhost_get_contents(bundle *b, char *content, unsigned int len)
 {
        int ret;
-       char *text, *app_id;
+       char *text = NULL, *app_pid = NULL, *app_name = NULL;
        pid_t pid;
 
        if (!b) {
@@ -148,14 +148,16 @@ static int usbhost_get_contents(bundle *b, char *content, unsigned int len)
                return -EINVAL;
        }
 
-       app_id = (char *)bundle_get_val(b, "_APP_PID_");
-       if (!app_id) {
+       app_pid = (char *)bundle_get_val(b, "_APP_PID_");
+       if (!app_pid) {
                _E("Failed to get pid");
                return -ENOENT;
        }
 
-       pid = atoi(app_id);
-       ret = app_manager_get_app_id(pid, &app_id);
+       pid = atoi(app_pid);
+       free(app_pid);
+
+       ret = app_manager_get_app_id(pid, &app_name);
        if (ret != APP_MANAGER_ERROR_NONE) {
                _E("Failed to get app id(%d)", ret);
                return -ENOENT;
@@ -163,11 +165,11 @@ static int usbhost_get_contents(bundle *b, char *content, unsigned int len)
 
        text = gl_text_get(0);
        if (text) {
-               snprintf(content, len, text, app_id);
+               snprintf(content, len, text, app_name);
                free(text);
        }
 
-       free(app_id);
+       free(app_name);
        return 0;
 }