Fix wrong return value 97/324097/1
authorjusung son <jusung07.son@samsung.com>
Tue, 13 May 2025 03:38:02 +0000 (12:38 +0900)
committerjusung son <jusung07.son@samsung.com>
Tue, 13 May 2025 03:38:02 +0000 (12:38 +0900)
- If an error occurs after changing to user layer, BUXTON_ERROR_NOT_EXIST is returned.

Change-Id: I4b83f10a4a53ae2a55881b5fb63a1d1383b107c0
Signed-off-by: jusung son <jusung07.son@samsung.com>
common/direct.c
daemon/daemon.c

index acc8aa750dfafdd4b1fa498e88d01a7ceb694cee..4806fd2624ccb7c2ecdfdc8c34f13c4b06c300a0 100644 (file)
@@ -209,7 +209,11 @@ int direct_get(const struct buxton_layer *bxt_layer,
        if (ly == NULL)
                return r;
 
+       bxt_info("Change to user layer : [%s] -> [%s]", bxt_layer->name, ly->name);
+
        r = get_value_with_layer(ly, bxt_layer, key, val);
+       if (r != BUXTON_ERROR_NONE)
+               return BUXTON_ERROR_NOT_EXIST;
 
        return r;
 }
@@ -393,7 +397,13 @@ int direct_set(const struct buxton_layer *bxt_layer,
        if (ly == NULL)
                return r;
 
-       return set_value_with_layer(ly, bxt_layer, key, val);
+       bxt_info("Change to user layer : [%s] -> [%s]", bxt_layer->name, ly->name);
+
+       r = set_value_with_layer(ly, bxt_layer, key, val);
+       if (r != BUXTON_ERROR_NONE)
+               return BUXTON_ERROR_NOT_EXIST;
+
+       return r;
 }
 
 static int direct_close(const struct buxton_layer *layer, const struct layer *ly)
@@ -542,7 +552,13 @@ int direct_unset(const struct buxton_layer *bxt_layer, const char *key)
        if (ly == NULL)
                return r;
 
-       return unset_with_layer(ly, bxt_layer, key);
+       bxt_info("Change to user layer : [%s] -> [%s]", bxt_layer->name, ly->name);
+
+       r = unset_with_layer(ly, bxt_layer, key);
+       if (r != BUXTON_ERROR_NONE)
+               return BUXTON_ERROR_NOT_EXIST;
+
+       return r;
 }
 
 static int comp_str(const void *pa, const void *pb)
@@ -756,8 +772,14 @@ int direct_get_priv(const struct buxton_layer *bxt_layer,
        if (ly == NULL)
                return r;
 
-       return get_val(ly, bxt_layer->uid, bxt_layer->user, LAYER_ATTRIBUTE_RO,
+       bxt_info("Change to user layer : [%s] -> [%s]", bxt_layer->name, ly->name);
+
+       r = get_val(ly, bxt_layer->uid, bxt_layer->user, LAYER_ATTRIBUTE_RO,
                        key, rp, wp, NULL);
+       if (r != BUXTON_ERROR_NONE)
+               return BUXTON_ERROR_NOT_EXIST;
+
+       return r;
 }
 
 int direct_set_priv(const struct buxton_layer *bxt_layer,
@@ -796,10 +818,12 @@ int direct_set_priv(const struct buxton_layer *bxt_layer,
                if (ly == NULL)
                        return r;
 
+               bxt_info("Change to user layer : [%s] -> [%s]", bxt_layer->name, ly->name);
+
                r = get_val(ly, bxt_layer->uid, bxt_layer->user, LAYER_ATTRIBUTE_RO,
                                key, &rp, &wp, &val);
                if (r != BUXTON_ERROR_NONE)
-                       return r;
+                       return BUXTON_ERROR_NOT_EXIST;
        }
 
        switch (type) {
index ba4a4d60d9ae19fb997cc4f6cfabe776555dba75..7611be8f9f30a03ce3caf89c7541a6f91a3d3c61 100644 (file)
@@ -660,6 +660,7 @@ static void proc_msg(struct bxt_client *cli,
 
        if (cli->cred.uid != 0 && cli->cred.uid != rqst->layer->uid) {
                /* Only root can access other user's */
+               bxt_err("proc msg: invalid uid [%d] [%d]", cli->cred.uid, rqst->layer->uid);
                resp->res = BUXTON_ERROR_PERMISSION_DENIED;
                return;
        }