Skip to content

Commit

Permalink
sign-file: Fix confusing error messages
Browse files Browse the repository at this point in the history
When an error occurs, use errx() instead of err() to display the
error message, because openssl has its own error record. When an
error occurs, errno will not be changed, while err() displays the
errno error message. It will cause confusion. For example, when
CMS_add1_signer() fails, the following message will appear:

  sign-file: CMS_add1_signer: Success

errx() ignores errno and does not cause such issue.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
  • Loading branch information
uudiin authored and jarkkojs committed Aug 3, 2022
1 parent 74ad433 commit 1a83950
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/sign-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static void drain_openssl_errors(void)
bool __cond = (cond); \
display_openssl_errors(__LINE__); \
if (__cond) { \
err(1, fmt, ## __VA_ARGS__); \
errx(1, fmt, ## __VA_ARGS__); \
} \
} while(0)

Expand Down

0 comments on commit 1a83950

Please sign in to comment.