treewide: replace local mkdir_p implementations
[project/procd.git] / jail / fs.c
index 42019734569781bf5a225433a73655e2ab68fa5b..26bc2825c6382dac75d325a965fc99a5d49e4d56 100644 (file)
--- a/jail/fs.c
+++ b/jail/fs.c
@@ -32,6 +32,7 @@
 #include <libubox/avl-cmp.h>
 #include <libubox/blobmsg.h>
 #include <libubox/list.h>
+#include <libubox/utils.h>
 
 #include "elf.h"
 #include "fs.h"
@@ -54,31 +55,6 @@ struct mount {
 
 struct avl_tree mounts;
 
-int mkdir_p(char *dir, mode_t mask)
-{
-       char *l = strrchr(dir, '/');
-       int ret;
-
-       if (!l)
-               return 0;
-
-       *l = '\0';
-
-       if (mkdir_p(dir, mask))
-               return -1;
-
-       *l = '/';
-
-       ret = mkdir(dir, mask);
-       if (ret && errno == EEXIST)
-               return 0;
-
-       if (ret)
-               ERROR("mkdir(%s, %d) failed: %m\n", dir, mask);
-
-       return ret;
-}
-
 static int do_mount(const char *root, const char *orig_source, const char *target, const char *filesystemtype,
                    unsigned long orig_mountflags, unsigned long propflags, const char *optstr, int error, bool inner)
 {