From: Andreas Reichel <[email protected]>

If a user variable is not found, return -ENOENT instead of -EINVAL.

Signed-off-by: Andreas Reichel <[email protected]>
---
 env/env_api_fat.c             | 2 +-
 env/uservars.c                | 2 +-
 tools/tests/test_ebgenv_api.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/env/env_api_fat.c b/env/env_api_fat.c
index a86c05d..94bd7b6 100644
--- a/env/env_api_fat.c
+++ b/env/env_api_fat.c
@@ -288,7 +288,7 @@ int bgenv_get(BGENV *env, char *key, uint64_t *type, void 
*data,
                        uint32_t size;
                        u = bgenv_find_uservar(env->data->userdata, key);
                        if (!u) {
-                               return -EINVAL;
+                               return -ENOENT;
                        }
                        bgenv_map_uservar(u, NULL, NULL, NULL, NULL, &size);
                        return size;
diff --git a/env/uservars.c b/env/uservars.c
index eff1cf8..013a208 100644
--- a/env/uservars.c
+++ b/env/uservars.c
@@ -104,7 +104,7 @@ int bgenv_get_uservar(uint8_t *udata, char *key, uint64_t 
*type, void *data,
        uservar = bgenv_find_uservar(udata, key);
 
        if (!uservar) {
-               return -EINVAL;
+               return -ENOENT;
        }
 
        bgenv_map_uservar(uservar, &lkey, &ltype, &value, NULL, &dsize);
diff --git a/tools/tests/test_ebgenv_api.c b/tools/tests/test_ebgenv_api.c
index fb6ca44..47abdeb 100644
--- a/tools/tests/test_ebgenv_api.c
+++ b/tools/tests/test_ebgenv_api.c
@@ -654,11 +654,11 @@ START_TEST(ebgenv_api_ebg_env_register_gc_var)
 
        /* Check if variables are deleted */
        res = ebg_env_get(&e, "VarA", NULL);
-       ck_assert_int_eq(res, -EINVAL);
+       ck_assert_int_eq(res, -ENOENT);
        res = ebg_env_get(&e, "VarB", NULL);
        ck_assert_int_eq(res, strlen("TestB") + 1);
        res = ebg_env_get(&e, "VarC", NULL);
-       ck_assert_int_eq(res, -EINVAL);
+       ck_assert_int_eq(res, -ENOENT);
 
        ebg_env_close(&e);
 }
-- 
2.17.0

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20180502123953.17619-5-andreas.reichel.ext%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to