return 0;
}
-static void print_top_failing_dir(const char *path)
-{
- size_t len = strlen(path);
- char *copy = alloca(len+1), *p, *e, saved;
- strcpy(copy, path);
-
- p = copy;
- e = copy + len;
- while (p < e) {
- while (p < e && *p == '/') p++;
- while (p < e && *p != '/') p++;
- if (p >= e)
- return;
- saved = *p;
- *p = '\0';
- if (access(copy, X_OK)) {
- SYSERROR("could not access %s. Please grant it 'x' " \
- "access, or add an ACL for the container root.",
- copy);
- return;
- }
- *p = saved;
- }
-}
-
static int mount_rootfs(const char *rootfs, const char *target, const char *options)
{
char absrootfs[MAXPATHLEN];
return -1;
}
- if (access(rootfs->path, R_OK)) {
- print_top_failing_dir(rootfs->path);
- return -1;
- }
-
if (detect_shared_rootfs()) {
if (chroot_into_slave(conf)) {
ERROR("Failed to chroot into slave /");
[LXC_NS_NET] = {"net", CLONE_NEWNET}
};
+static void print_top_failing_dir(const char *path)
+{
+ size_t len = strlen(path);
+ char *copy = alloca(len+1), *p, *e, saved;
+ strcpy(copy, path);
+
+ p = copy;
+ e = copy + len;
+ while (p < e) {
+ while (p < e && *p == '/') p++;
+ while (p < e && *p != '/') p++;
+ if (p >= e)
+ return;
+ saved = *p;
+ *p = '\0';
+ if (access(copy, X_OK)) {
+ SYSERROR("could not access %s. Please grant it 'x' " \
+ "access, or add an ACL for the container root.",
+ copy);
+ return;
+ }
+ *p = saved;
+ }
+}
+
static void close_ns(int ns_fd[LXC_NS_MAX]) {
int i;
}
}
+ if (access(handler->lxcpath, R_OK)) {
+ print_top_failing_dir(handler->lxcpath);
+ goto out_warn_father;
+ }
+
#if HAVE_SYS_CAPABILITY_H
if (handler->conf->need_utmp_watch) {
if (prctl(PR_CAPBSET_DROP, CAP_SYS_BOOT, 0, 0, 0)) {