]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/install.c
util-lib: introduce dirent-util.[ch] for directory entry calls
[thirdparty/systemd.git] / src / shared / install.c
index 9b72f766628ba652ae33df3dcab5f7cf40c70d0d..bfafb59008e30a45a050a3e700fbd14e4539eeac 100644 (file)
 
 #include "conf-files.h"
 #include "conf-parser.h"
+#include "dirent-util.h"
+#include "fd-util.h"
 #include "hashmap.h"
 #include "install-printf.h"
+#include "install.h"
 #include "mkdir.h"
 #include "path-lookup.h"
 #include "path-util.h"
@@ -38,8 +41,6 @@
 #include "strv.h"
 #include "unit-name.h"
 #include "util.h"
-#include "install.h"
-#include "fd-util.h"
 
 typedef struct {
         OrderedHashmap *will_install;
@@ -48,13 +49,12 @@ typedef struct {
 
 static int in_search_path(const char *path, char **search) {
         _cleanup_free_ char *parent = NULL;
-        int r;
 
         assert(path);
 
-        r = path_get_parent(path, &parent);
-        if (r < 0)
-                return r;
+        parent = dirname_malloc(path);
+        if (!parent)
+                return -ENOMEM;
 
         return strv_contains(search, parent);
 }