From 0f6c89b3c5363deeae92e9a32fa3789862d4c009 Mon Sep 17 00:00:00 2001 From: zhaoxiaohu Date: Wed, 28 Aug 2024 16:44:53 +0800 Subject: [PATCH] test-boot-timestamp: Handle ERANGE error Signed-off-by: zhaoxiaohu --- ...t-boot-timestamp-Handle-ERANGE-error.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 backport-test-boot-timestamp-Handle-ERANGE-error.patch diff --git a/backport-test-boot-timestamp-Handle-ERANGE-error.patch b/backport-test-boot-timestamp-Handle-ERANGE-error.patch new file mode 100644 index 0000000..2c24f6b --- /dev/null +++ b/backport-test-boot-timestamp-Handle-ERANGE-error.patch @@ -0,0 +1,36 @@ +From 0da4cc97b446b43802692f2415e5a774771b0ca9 Mon Sep 17 00:00:00 2001 +From: Daan De Meyer +Date: Mon, 13 Feb 2023 14:27:24 +0100 +Subject: [PATCH] test-boot-timestamp: Handle ERANGE error + +Timestampfs from sysfs files can be zero in which case ERANGE will +be returned so let's make sure we catch that. + +(cherry picked from commit 0da4cc97b446b43802692f2415e5a774771b0ca9) +(cherry picked from commit ef96e60f18c6fd267dc0e942120a95fe25a94960) +(cherry picked from commit 18a2aaf2f6c2c55f825632c25b07b121f6a1bb78) + +Reference: https://github.com/systemd/systemd-stable/pull/259/commits/6986ac916029217e668cc98955b6a3db9497d073 + +Signed-off-by: zhaoxiaohu +Signed-off-by: yuwang +--- + src/test/test-boot-timestamps.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/test/test-boot-timestamps.c b/src/test/test-boot-timestamps.c +index ae5b582..35268c1 100644 +--- a/src/test/test-boot-timestamps.c ++++ b/src/test/test-boot-timestamps.c +@@ -17,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 = r == -ENOENT || r == -EACCES || r == -ENODATA || r == -ERANGE; + + log_full_errno(ok ? LOG_DEBUG : LOG_ERR, r, "Failed to read ACPI FPDT: %m"); + return ok ? 0 : r; +-- +2.33.0 +