parent e0af2046
...@@ -3461,7 +3461,6 @@ static bool verify_start_hooks(struct lxc_conf *conf) ...@@ -3461,7 +3461,6 @@ static bool verify_start_hooks(struct lxc_conf *conf)
lxc_list_for_each (it, &conf->hooks[LXCHOOK_START]) { lxc_list_for_each (it, &conf->hooks[LXCHOOK_START]) {
int ret; int ret;
struct stat st;
char *hookname = it->elem; char *hookname = it->elem;
ret = snprintf(path, PATH_MAX, "%s%s", ret = snprintf(path, PATH_MAX, "%s%s",
...@@ -3470,9 +3469,9 @@ static bool verify_start_hooks(struct lxc_conf *conf) ...@@ -3470,9 +3469,9 @@ static bool verify_start_hooks(struct lxc_conf *conf)
if (ret < 0 || ret >= PATH_MAX) if (ret < 0 || ret >= PATH_MAX)
return false; return false;
ret = stat(path, &st); ret = access(path, X_OK);
if (ret < 0) { if (ret < 0) {
SYSERROR("Start hook %s not found in container", SYSERROR("Start hook \"%s\" not found in container",
hookname); hookname);
return false; return false;
} }
...@@ -3551,10 +3550,6 @@ int lxc_setup(struct lxc_handler *handler) ...@@ -3551,10 +3550,6 @@ int lxc_setup(struct lxc_handler *handler)
return -1; 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 (lxc_conf->is_execute) {
if (execveat_supported()) { if (execveat_supported()) {
int fd; int fd;
...@@ -3622,6 +3617,12 @@ int lxc_setup(struct lxc_handler *handler) ...@@ -3622,6 +3617,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, ret = lxc_setup_console(&lxc_conf->rootfs, &lxc_conf->console,
lxc_conf->ttys.dir); lxc_conf->ttys.dir);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment