[IMPROVE] parser: empty PID string support 54/15554/1
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 23 Jan 2014 08:16:04 +0000 (12:16 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 23 Jan 2014 08:36:50 +0000 (12:36 +0400)
empty PID means no PID filtering

Change-Id: If4b5731c8ae3f9111692dd50581752328562b2b9
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
parser/msg_parser.c
parser/us_inst.c

index fa71e57..0414936 100644 (file)
@@ -97,11 +97,15 @@ struct app_info_data *create_app_info(struct msg_buf *mb)
                ai->tgid = 0;
                break;
        case AT_PID: {
-               u32 tgid;
-               ret = str_to_u32(ta_id, &tgid);
-               if (ret) {
-                       print_err("converting string to PID, str='%s'\n", ta_id);
-                       goto free_ai;
+               u32 tgid = 0;
+
+               if (*ta_id != '\0') {
+                       ret = str_to_u32(ta_id, &tgid);
+                       if (ret) {
+                               print_err("converting string to PID, "
+                                         "str='%s'\n", ta_id);
+                               goto free_ai;
+                       }
                }
 
                ai->tgid = tgid;
index e402277..4e392c6 100644 (file)
@@ -114,10 +114,14 @@ static int get_pfg_by_app_info(struct app_info_data *app_info, struct pf_group *
 
        switch (app_info->app_type) {
        case AT_PID:
+               if (app_info->tgid == 0)
+                       goto pf_dentry;
+
                *pfg = get_pf_group_by_tgid(app_info->tgid, dentry);
                break;
        case AT_TIZEN_NATIVE_APP:
        case AT_COMMON_EXEC:
+ pf_dentry:
                *pfg = get_pf_group_by_dentry(dentry, dentry);
                break;
        default: