Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix varstore-sb-state exit code #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tescande
Copy link

In 'user' mode, varstore-sb-state exit code is the returned value of the function setup_keys() which returns true on success and false otherwise. The exit code is then 1 on success and 0 on failure, the opposite of the 'setup' mode.

This patch fixes the exit code, returning 0 when setup_keys() succeeds and 1 otherwise.

In 'user' mode, varstore-sb-state exit code is the returned value of the
function setup_keys() which returns true on success and false otherwise.
The exit code is then 1 on success and 0 on failure, the opposite of the
'setup' mode.

This patch fixes the exit code, returning 0 when setup_keys() succeeds
and 1 otherwise.

Signed-off-by: Thierry Escande <thierry.escande@vates.tech>
@stormi
Copy link
Contributor

stormi commented Oct 25, 2023

Regarding return codes, this will change the return code from 1 to 0 also in this case: xcp-ng@74a5856. Is it the expected behaviour? I thought it would return false, due to the fact that switching to user mode failed.

@tescande
Copy link
Author

tescande commented Dec 6, 2023

Hi @rosslagerwall

Thanks for the approval but I cannot add other reviewers myself. Would you mind please ?

Regards,
Thierry

@stormi
Copy link
Contributor

stormi commented Mar 21, 2024

Another approval is necessary, but we can't add reviewers ourselves.

@@ -112,7 +112,7 @@ int main(int argc, char **argv)
do_rm(&gEfiImageSecurityDatabaseGuid, "dbx");

if (!strcmp(argv[optind + 1], "user"))
return setup_keys();
return (setup_keys() ? 0 : 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return !setup_keys(); ? Or return (setup_keys() ? EXIT_SUCCESS : EXIT_FAILURE); to be more explicit ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants