diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2016-12-13 11:34:09 +0000 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2016-12-13 13:03:13 +0000 |
commit | a6f72863adda77b3b6c7b08b0c85f41c6ba2a6d1 (patch) | |
tree | 1d15a7eebe561c2e44d732d3c13acfc8b7e39359 /src/machine-id-setup | |
parent | fcb2427055bc2e1d8f009ebf3b4d8b1b2bb14faa (diff) | |
download | systemd-a6f72863adda77b3b6c7b08b0c85f41c6ba2a6d1.tar.gz |
machine-id-setup: `--print --commit` respects the --root option
Diffstat (limited to 'src/machine-id-setup')
-rw-r--r-- | src/machine-id-setup/machine-id-setup-main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c index cc9b1b38fe..2244b1cc76 100644 --- a/src/machine-id-setup/machine-id-setup-main.c +++ b/src/machine-id-setup/machine-id-setup-main.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> +#include "id128-util.h" #include "log.h" #include "machine-id-setup.h" #include "path-util.h" @@ -118,11 +119,14 @@ int main(int argc, char *argv[]) { goto finish; if (arg_commit) { + const char *etc_machine_id; + r = machine_id_commit(arg_root); if (r < 0) goto finish; - r = sd_id128_get_machine(&id); + etc_machine_id = prefix_roota(arg_root, "/etc/machine-id"); + r = id128_read(etc_machine_id, ID128_PLAIN, &id); if (r < 0) { log_error_errno(r, "Failed to read machine ID back: %m"); goto finish; |