Fix to check return value of notification_get_id 15/175615/2
authorSemun Lee <semun.lee@samsung.com>
Wed, 11 Apr 2018 05:58:51 +0000 (14:58 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Wed, 11 Apr 2018 06:25:13 +0000 (15:25 +0900)
priv_id can be used for private sharing related code also.

Change-Id: I279562d047b2efef30e067d251bcbc34d8925a37
Signed-off-by: Semun Lee <semun.lee@samsung.com>
src/notification_service.c

index f11266c..3501f18 100755 (executable)
@@ -735,11 +735,16 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid)
 
        __print_noti(noti);
 
+       ret = notification_get_id(noti, NULL, &priv_id);
+       if (ret != NOTIFICATION_ERROR_NONE) {
+               ERR("Failed to get priv_id [%d]", ret);
+               return ret;
+       }
+
        if (notification_validate_private_sharing(noti) == false) {
                source_noti = notification_create(NOTIFICATION_TYPE_NOTI);
                if (source_noti == NULL)
                        return get_last_result();
-               notification_get_id(noti, NULL, &priv_id);
                notification_noti_get_by_priv_id(source_noti, priv_id);
 
                notification_calibrate_private_sharing(noti, source_noti);
@@ -752,12 +757,6 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid)
                return ret;
        }
 
-       ret = notification_get_id(noti, NULL, &priv_id);
-       if (ret != NOTIFICATION_ERROR_NONE) {
-               ERR("Failed to gets priv_id [%d]", ret);
-               return ret;
-       }
-
        notification_set_private_sharing(noti, uid);
 
        body = notification_ipc_make_gvariant_from_noti(noti, true);