Skip to content

Commit

Permalink
Merge pull request #2687 from brauner/2018-10-10/fix_verify_start_hooks
Browse files Browse the repository at this point in the history
conf: verify_start_hooks() after lxc.mount.entry
  • Loading branch information
stgraber committed Oct 10, 2018
2 parents 8a2ae16 + 7519366 commit d354a97
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/lxc/conf.c
Expand Up @@ -3514,7 +3514,6 @@ static bool verify_start_hooks(struct lxc_conf *conf)

lxc_list_for_each (it, &conf->hooks[LXCHOOK_START]) {
int ret;
struct stat st;
char *hookname = it->elem;

ret = snprintf(path, PATH_MAX, "%s%s",
Expand All @@ -3523,9 +3522,9 @@ static bool verify_start_hooks(struct lxc_conf *conf)
if (ret < 0 || ret >= PATH_MAX)
return false;

ret = stat(path, &st);
ret = access(path, X_OK);
if (ret < 0) {
SYSERROR("Start hook %s not found in container",
SYSERROR("Start hook \"%s\" not found in container",
hookname);
return false;
}
Expand Down Expand Up @@ -3604,10 +3603,6 @@ int lxc_setup(struct lxc_handler *handler)
return -1;
}

/* Make sure any start hooks are in the container */
if (!verify_start_hooks(lxc_conf))
return -1;

if (lxc_conf->is_execute) {
if (execveat_supported()) {
int fd;
Expand Down Expand Up @@ -3675,6 +3670,12 @@ int lxc_setup(struct lxc_handler *handler)
}
}

/* Make sure any start hooks are in the container */
if (!verify_start_hooks(lxc_conf)) {
ERROR("Failed to verify start hooks");
return -1;
}

ret = lxc_setup_console(&lxc_conf->rootfs, &lxc_conf->console,
lxc_conf->ttys.dir);
if (ret < 0) {
Expand Down

0 comments on commit d354a97

Please sign in to comment.