sign-file: Fix confusing error messages
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Mon, 27 Jun 2022 09:21:07 +0000 (17:21 +0800)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 3 Aug 2022 20:56:20 +0000 (23:56 +0300)
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>
scripts/sign-file.c

index 7434e9e..598ef54 100644 (file)
@@ -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)