test-unit-name: simplify machine-id check

This commit is contained in:
Nick Rosbrook
2022-12-14 13:58:12 -05:00
parent 079fcdd04f
commit a635b6279c
+3 -1
View 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);
}