1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

networkd: fix creation of runtime dirs at startup

This allows us to drop the repeated attempted creations of the runtime dirs during runtime.
This commit is contained in:
Tom Gundersen 2014-03-13 19:02:28 +01:00
parent 2a1763edfb
commit 0ea51a1129
4 changed files with 14 additions and 14 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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) {