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

index 98fffc7c87e4fb12f86b1b022d71eb52c823dffa..c6428e844f8ecbbfc7558da6d2e57ed3f95560a7 100644 (file)
@@ -3,6 +3,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "sd-id128.h"
+
 #include "alloc-util.h"
 #include "all-units.h"
 #include "glob-util.h"
@@ -261,7 +263,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);
         }