From 1358081487650f718ad84b26313bcc16a3093e04 Mon Sep 17 00:00:00 2001 From: Nick Rosbrook Date: Tue, 13 Dec 2022 12:22:37 -0500 Subject: [PATCH] test-unit-name: simplify machine-id check (cherry picked from commit a635b6279cf35abad3abe169780ec899df9396df) Related: RHEL-27512 --- src/test/test-unit-name.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c index eec4831b4e..1e230ba5f9 100644 --- a/src/test/test-unit-name.c +++ b/src/test/test-unit-name.c @@ -3,6 +3,8 @@ #include #include +#include "sd-id128.h" + #include "alloc-util.h" #include "all-units.h" #include "glob-util.h" @@ -264,7 +266,7 @@ TEST_RET(unit_printf, .sd_booted = true) { assert_se(short_hostname); assert_se(specifier_pretty_hostname('q', NULL, NULL, NULL, &pretty_hostname) == 0); assert_se(pretty_hostname); - if (access("/etc/machine-id", F_OK) >= 0) { + if (sd_id128_get_machine(NULL) >= 0) { assert_se(specifier_machine_id('m', NULL, NULL, NULL, &machine_id) >= 0); assert_se(machine_id); }