diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-05-17 18:13:13 +0900 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-05-17 15:54:24 +0200 |
commit | 9ce14a75e7e347a304c44edb1dfe8d92e0c04fae (patch) | |
tree | 9666de212770b728c4b8bf41699a16ccaf368bc6 /src/test/test-boot-timestamps.c | |
parent | 3b7493dcfa743c6e7c5fb33fb869be14009794bb (diff) | |
download | systemd-9ce14a75e7e347a304c44edb1dfe8d92e0c04fae.tar.gz |
test-boot-timestamp: use ERRNO_IS_PRIVILEGE() to also mask -EPERM
Fixes #23395.
Diffstat (limited to 'src/test/test-boot-timestamps.c')
-rw-r--r-- | src/test/test-boot-timestamps.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/test-boot-timestamps.c b/src/test/test-boot-timestamps.c index 2bee2d5c1d..a9875defdd 100644 --- a/src/test/test-boot-timestamps.c +++ b/src/test/test-boot-timestamps.c @@ -6,6 +6,7 @@ #include "acpi-fpdt.h" #include "boot-timestamps.h" #include "efi-loader.h" +#include "errno-util.h" #include "log.h" #include "tests.h" #include "util.h" @@ -16,7 +17,7 @@ static int test_acpi_fpdt(void) { r = acpi_get_boot_usec(&loader_start, &loader_exit); if (r < 0) { - bool ok = r == -ENOENT || r == -EACCES || r == -ENODATA; + bool ok = IN_SET(r, -ENOENT, -ENODATA) || ERRNO_IS_PRIVILEGE(r); log_full_errno(ok ? LOG_DEBUG : LOG_ERR, r, "Failed to read ACPI FPDT: %m"); return ok ? 0 : r; @@ -35,7 +36,7 @@ static int test_efi_loader(void) { r = efi_loader_get_boot_usec(&loader_start, &loader_exit); if (r < 0) { - bool ok = r == -ENOENT || r == -EACCES || r == -EOPNOTSUPP; + bool ok = IN_SET(r, -ENOENT, -EOPNOTSUPP) || ERRNO_IS_PRIVILEGE(r); log_full_errno(ok ? LOG_DEBUG : LOG_ERR, r, "Failed to read EFI loader data: %m"); return ok ? 0 : r; @@ -56,7 +57,7 @@ static int test_boot_timestamps(void) { r = boot_timestamps(NULL, &fw, &l); if (r < 0) { - bool ok = r == -ENOENT || r == -EACCES || r == -EOPNOTSUPP; + bool ok = IN_SET(r, -ENOENT, -EOPNOTSUPP) || ERRNO_IS_PRIVILEGE(r); log_full_errno(ok ? LOG_DEBUG : LOG_ERR, r, "Failed to read variables: %m"); return ok ? 0 : r; |