summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-16 12:35:46 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-16 14:00:25 +0200
commitd5891fdacf761130c9babdb5e50367504d29970c (patch)
treece1378e3c873d1e4fc908b9de5afb8d050936586 /src
parent4a271908f1d46e0549a4d9bfc5d0e34266887695 (diff)
install: treat non-existent directory as empty
When looking for symlinks, it doesn't make sense to error-out if the directory is missing. The user might delete an empty directory. This check caused test-unit-file to fail when run before installation.
Diffstat (limited to 'src')
-rw-r--r--src/shared/install.c5
-rw-r--r--src/test/test-unit-file.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 1a69337f5a..0d38bccd72 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -524,8 +524,11 @@ static int find_symlinks(
assert(same_name_link);
fd = open(config_path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
- if (fd < 0)
+ if (fd < 0) {
+ if (errno == ENOENT)
+ return 0;
return -errno;
+ }
/* This takes possession of fd and closes it */
return find_symlinks_fd(name, fd, config_path, config_path, same_name_link);
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index b390c44b05..95e2b68015 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
assert(h);
r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL, h);
- log_info("%s", strerror(-r));
+ log_info("unit_file_get_list: %s", strerror(-r));
assert(r >= 0);
HASHMAP_FOREACH(p, h, i)