mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
test-load-fragment: do not fail if machine-id is missing
When building in a chroot there might not be any machine-id
This commit is contained in:
@@ -518,8 +518,10 @@ TEST(install_printf, .sd_booted = true) {
|
||||
|
||||
_cleanup_free_ char *mid = NULL, *bid = NULL, *host = NULL, *gid = NULL, *group = NULL, *uid = NULL, *user = NULL;
|
||||
|
||||
assert_se(specifier_machine_id('m', NULL, NULL, NULL, &mid) >= 0 && mid);
|
||||
assert_se(specifier_boot_id('b', NULL, NULL, NULL, &bid) >= 0 && bid);
|
||||
if (access("/etc/machine-id", F_OK) >= 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);
|
||||
assert_se(host = gethostname_malloc());
|
||||
assert_se(group = gid_to_name(getgid()));
|
||||
assert_se(asprintf(&gid, UID_FMT, getgid()) >= 0);
|
||||
|
||||
Reference in New Issue
Block a user