#include <libubox/avl-cmp.h>
#include <libubox/blobmsg.h>
#include <libubox/list.h>
+#include <libubox/utils.h>
-#include "fs.h"
#include "log.h"
#include "cgroups.h"
#include <libubox/avl-cmp.h>
#include <libubox/blobmsg.h>
#include <libubox/list.h>
+#include <libubox/utils.h>
#include "elf.h"
#include "fs.h"
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)
{
#include <sys/mount.h>
#include <libubox/blobmsg.h>
-int mkdir_p(char *dir, mode_t mask);
int add_mount(const char *source, const char *target, const char *filesystemtype,
unsigned long mountflags, unsigned long propflags, const char *optstr, int error);
int add_mount_inner(const char *source, const char *target, const char *filesystemtype,
#include "seccomp-oci.h"
#include "cgroups.h"
-#include <libubox/utils.h>
#include <libubox/blobmsg.h>
#include <libubox/blobmsg_json.h>
#include <libubox/list.h>
#include <libubox/vlist.h>
#include <libubox/uloop.h>
+#include <libubox/utils.h>
#include <libubus.h>
#ifndef CLONE_NEWCGROUP
#include <libubox/blobmsg_json.h>
#include <libubox/json_script.h>
#include <libubox/uloop.h>
+#include <libubox/utils.h>
#include <json-c/json.h>
#include <errno.h>
return NULL;
}
-static void mkdir_p(char *dir)
-{
- char *l = strrchr(dir, '/');
-
- if (l) {
- *l = '\0';
- mkdir_p(dir);
- *l = '/';
- mkdir(dir, 0755);
- }
-}
-
static void chgrp_error(const char *group, const char *target, const char *failed)
{
ERROR("cannot set group %s for %s (%s: %d)\n",
char *d = strdup(blobmsg_get_string(tb[0]));
d = dirname(d);
- mkdir_p(d);
+ mkdir_p(d, 0755);
free(d);
if (!strcmp(subsystem, "block"))