chiark / gitweb /
util: simplify close_nointr() a bit
[elogind.git] / src / shared / install.c
index 276ca3ec7a3c26f2f7ffc28f05f0a196cd67d09d..03c7a9da2eb08e91031f51085f77a4a759bf1b7b 100644 (file)
@@ -1061,7 +1061,7 @@ static int unit_file_load(
         assert(path);
 
         if (!isempty(root_dir))
-                path = strappenda3(root_dir, "/", path);
+                path = strappenda(root_dir, "/", path);
 
         fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|(allow_symlink ? 0 : O_NOFOLLOW));
         if (fd < 0)
@@ -2044,6 +2044,12 @@ int unit_file_get_list(
         if (root_dir && scope != UNIT_FILE_SYSTEM)
                 return -EINVAL;
 
+        if (root_dir) {
+                r = access(root_dir, F_OK);
+                if (r < 0)
+                        return -errno;
+        }
+
         r = lookup_paths_init_from_scope(&paths, scope, root_dir);
         if (r < 0)
                 return r;