From: Andreas Reichel <[email protected]>

Make negative return values in environment setters consistent.

Signed-off-by: Andreas Reichel <[email protected]>
---
 env/env_api.c     | 6 +++---
 tools/bg_setenv.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/env/env_api.c b/env/env_api.c
index bd034af..ea55bad 100644
--- a/env/env_api.c
+++ b/env/env_api.c
@@ -171,7 +171,7 @@ int ebg_env_setglobalstate(ebgenv_t *e, uint16_t ustate)
        int res;
 
        if (ustate > USTATE_FAILED) {
-               return EINVAL;
+               return -EINVAL;
        }
        (void)snprintf(buffer, sizeof(buffer), "%d", ustate);
        res = bgenv_set((BGENV *)e->bgenv, "ustate", 0, buffer,
@@ -190,10 +190,10 @@ int ebg_env_setglobalstate(ebgenv_t *e, uint16_t ustate)
                env->data->ustate = ustate;
                if (!bgenv_write(env)) {
                        (void)bgenv_close(env);
-                       return EIO;
+                       return -EIO;
                }
                if (!bgenv_close(env)) {
-                       return EIO;
+                       return -EIO;
                }
        }
        return 0;
diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index bc65c51..746d474 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -146,7 +146,7 @@ static void journal_process_action(BGENV *env, struct 
env_action *action)
                        if ((ret = ebg_env_setglobalstate(&e, ustate)) != 0) {
                                fprintf(stderr,
                                        "Error setting global state: %s.",
-                                       strerror(ret));
+                                       strerror(-ret));
                        }
                        return;
                }
-- 
2.15.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/20171114132241.2161-4-andreas.reichel.ext%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to