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
base: master
Are you sure you want to change the base?
Conversation
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>
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. |
Thanks for the approval but I cannot add other reviewers myself. Would you mind please ? Regards, |
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); |
There was a problem hiding this comment.
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 ?
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.