]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-load-fragment: simplify machine-id check
authorNick Rosbrook <nick.rosbrook@canonical.com>
Tue, 13 Dec 2022 17:25:35 +0000 (12:25 -0500)
committerNick Rosbrook <nick.rosbrook@canonical.com>
Wed, 14 Dec 2022 18:58:12 +0000 (13:58 -0500)
src/test/test-load-fragment.c

index 3cf704134c0b08dcfa76e7f7ffc6a48c37965c7d..997c2b252461c93135fb4cc1fb2d974adc362fcc 100644 (file)
@@ -5,6 +5,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include "sd-id128.h"
+
 #include "all-units.h"
 #include "alloc-util.h"
 #include "capability-util.h"
@@ -518,7 +520,7 @@ TEST(install_printf, .sd_booted = true) {
 
         _cleanup_free_ char *mid = NULL, *bid = NULL, *host = NULL, *gid = NULL, *group = NULL, *uid = NULL, *user = NULL;
 
-        if (access("/etc/machine-id", F_OK) >= 0)
+        if (sd_id128_get_machine(NULL) >= 0)
                 assert_se(specifier_machine_id('m', NULL, NULL, NULL, &mid) >= 0 && mid);
         if (sd_booted() > 0)
                 assert_se(specifier_boot_id('b', NULL, NULL, NULL, &bid) >= 0 && bid);