diff options
author | Tom Gundersen <teg@jklm.no> | 2014-03-13 19:02:28 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-03-14 12:44:17 +0100 |
commit | 0ea51a1129b9984a3c6d96cef1b0e33c99b5e9cf (patch) | |
tree | a83f8b579a15e9deda17f2cc94c3bf55cd2b8fa7 | |
parent | 2a1763edfbdb95be643d595afbcc64f3fc092e46 (diff) |
networkd: fix creation of runtime dirs at startup
This allows us to drop the repeated attempted creations of the runtime dirs during runtime.
-rw-r--r-- | src/libsystemd-network/sd-dhcp-lease.c | 4 | ||||
-rw-r--r-- | src/network/networkd-link.c | 4 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 4 | ||||
-rw-r--r-- | src/network/networkd.c | 16 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index f7a204af82..e6d80d4c66 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -297,10 +297,6 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) { assert(lease); assert(lease_file); - r = mkdir_safe_label("/run/systemd/network/leases", 0755, 0, 0); - if (r < 0) - goto finish; - r = fopen_temporary(lease_file, &f, &temp_path); if (r < 0) goto finish; diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 39cef2254c..2650f86357 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1367,10 +1367,6 @@ int link_save(Link *link) { assert(link); assert(link->state_file); - r = mkdir_safe_label("/run/systemd/network/links", 0755, 0, 0); - if (r < 0) - goto finish; - r = fopen_temporary(link->state_file, &f, &temp_path); if (r < 0) goto finish; diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index f41914f880..8c2f5efbd3 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -407,10 +407,6 @@ int manager_update_resolv_conf(Manager *m) { assert(m); - r = mkdir_safe_label("/run/systemd/network", 0755, 0, 0); - if (r < 0) - return r; - r = fopen_temporary("/run/systemd/network/resolv.conf", &f, &temp_path); if (r < 0) return r; diff --git a/src/network/networkd.c b/src/network/networkd.c index 2f6a12dbcc..f0e6ad5201 100644 --- a/src/network/networkd.c +++ b/src/network/networkd.c @@ -42,8 +42,20 @@ int main(int argc, char *argv[]) { /* Always create the directories people can create inotify * watches in. */ - mkdir_label("/run/systemd/network/links", 0755); - mkdir_label("/run/systemd/network/leases", 0755); + r = mkdir_label("/run/systemd/network", 0755); + if (r < 0) + log_error("Could not create runtime directory: %s", + strerror(-r)); + + r = mkdir_label("/run/systemd/network/links", 0755); + if (r < 0) + log_error("Could not create runtime directory 'links': %s", + strerror(-r)); + + r = mkdir_label("/run/systemd/network/leases", 0755); + if (r < 0) + log_error("Could not create runtime directory 'leases': %s", + strerror(-r)); r = manager_new(&m); if (r < 0) { |