summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-06 22:49:19 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-06 23:16:16 -0500
commit874310b7b68c4c0d36ff07397db30a959bb7dae5 (patch)
tree751b1bb5db5c3ad7c60b199476b47e44e326bf46 /src/core
parent56ba3c78ae35065064c4289a0c8e22a81256af20 (diff)
systemd: do not remove empty paths from unit lookup path
The ability to start a new unit with 'systemctl start ...' should not depend on whether there are other units in the directory. Previously, an additional 'systemctl daemon-reload' would be necessary to tell systemd to update the list of unit lookup paths.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/manager.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index b538a9a3a..25aa1be12 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -621,14 +621,15 @@ int manager_coldplug(Manager *m) {
static void manager_build_unit_path_cache(Manager *m) {
char **i;
- DIR *d = NULL;
+ DIR _cleanup_free_ *d = NULL;
int r;
assert(m);
set_free_free(m->unit_path_cache);
- if (!(m->unit_path_cache = set_new(string_hash_func, string_compare_func))) {
+ m->unit_path_cache = set_new(string_hash_func, string_compare_func);
+ if (!m->unit_path_cache) {
log_error("Failed to allocate unit path cache.");
return;
}
@@ -641,7 +642,8 @@ static void manager_build_unit_path_cache(Manager *m) {
d = opendir(*i);
if (!d) {
- log_error("Failed to open directory: %m");
+ if (errno != ENOENT)
+ log_error("Failed to open directory %s: %m", *i);
continue;
}
@@ -657,7 +659,8 @@ static void manager_build_unit_path_cache(Manager *m) {
goto fail;
}
- if ((r = set_put(m->unit_path_cache, p)) < 0) {
+ r = set_put(m->unit_path_cache, p);
+ if (r < 0) {
free(p);
goto fail;
}
@@ -674,9 +677,6 @@ fail:
set_free_free(m->unit_path_cache);
m->unit_path_cache = NULL;
-
- if (d)
- closedir(d);
}
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {