systemd/0776-test-load-fragment-simplify-machine-id-check.patch

35 lines
1.2 KiB
Diff
Raw Normal View History

From 5447ec5233b3079075dfac92ae3decf38f845e0e Mon Sep 17 00:00:00 2001
From: Nick Rosbrook <nick.rosbrook@canonical.com>
Date: Tue, 13 Dec 2022 12:25:35 -0500
Subject: [PATCH] test-load-fragment: simplify machine-id check
(cherry picked from commit 2c6b738badf1404b3ceb7e322eeeb736b57f6162)
Related: RHEL-27512
---
src/test/test-load-fragment.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/test/test-load-fragment.c b/src/test/test-load-fragment.c
index 3cf704134c..997c2b2524 100644
--- a/src/test/test-load-fragment.c
+++ b/src/test/test-load-fragment.c
@@ -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);