diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-04-11 12:49:52 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-04-11 13:20:33 +0200 |
commit | 6996295f85a0402b8a72d76c1eab02fb8152f81d (patch) | |
tree | 48cb21bf5a2ccd64d078952b1825917ba0ae8b36 /src/machine-id-setup.c | |
parent | 966a5d37c3405afe105fbdb4209c4de64747e00f (diff) |
machine-id: don't delete runtime machine-id, and place it in /run
Diffstat (limited to 'src/machine-id-setup.c')
-rw-r--r-- | src/machine-id-setup.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/machine-id-setup.c b/src/machine-id-setup.c index 0ee3cd7ae1..94198cb83b 100644 --- a/src/machine-id-setup.c +++ b/src/machine-id-setup.c @@ -235,28 +235,25 @@ int machine_id_setup(void) { fd = -1; /* Hmm, we couldn't write it? So let's write it to - * /run/systemd/machine-id as a replacement */ - - mkdir_p("/run/systemd", 0755); + * /run/machine-id as a replacement */ m = umask(0022); - r = write_one_line_file("/run/systemd/machine-id", id); + r = write_one_line_file("/run/machine-id", id); umask(m); if (r < 0) { - log_error("Cannot write /run/systemd/machine-id: %s", strerror(-r)); + log_error("Cannot write /run/machine-id: %s", strerror(-r)); - unlink("/run/systemd/machine-id"); + unlink("/run/machine-id"); goto finish; } /* And now, let's mount it over */ - r = mount("/run/systemd/machine-id", "/etc/machine-id", "bind", MS_BIND|MS_RDONLY, NULL) < 0 ? -errno : 0; - unlink("/run/systemd/machine-id"); - - if (r < 0) + r = mount("/run/machine-id", "/etc/machine-id", "bind", MS_BIND|MS_RDONLY, NULL) < 0 ? -errno : 0; + if (r < 0) { + unlink("/run/machine-id"); log_error("Failed to mount /etc/machine-id: %s", strerror(-r)); - else + } else log_info("Installed transient /etc/machine-id file."); finish: |