int lxc_execute(const char *name, char *const argv[], int quiet,
struct lxc_handler *handler, const char *lxcpath,
- bool backgrounded)
+ bool backgrounded, int *error_num)
{
struct execute_args args = {.argv = argv, .quiet = quiet};
handler->conf->is_execute = 1;
return __lxc_start(name, handler, &execute_start_ops, &args, lxcpath,
- backgrounded);
+ backgrounded, error_num);
}
*/
extern int lxc_start(const char *name, char *const argv[],
struct lxc_handler *handler, const char *lxcpath,
- bool backgrounded);
+ bool backgrounded, int *error_num);
/*
* Start the specified command inside an application container
*/
extern int lxc_execute(const char *name, char *const argv[], int quiet,
struct lxc_handler *handler, const char *lxcpath,
- bool backgrounded);
+ bool backgrounded, int *error_num);
/*
* Close the fd associated with the monitoring
}
if (useinit)
- ret = lxc_execute(c->name, argv, 1, handler, c->config_path, daemonize);
+ ret = lxc_execute(c->name, argv, 1, handler, c->config_path, daemonize, &c->error_num);
else
- ret = lxc_start(c->name, argv, handler, c->config_path, daemonize);
- c->error_num = handler->exit_status;
+ ret = lxc_start(c->name, argv, handler, c->config_path, daemonize, &c->error_num);
if (conf->reboot == 1) {
INFO("Container requested reboot");
int __lxc_start(const char *name, struct lxc_handler *handler,
struct lxc_operations* ops, void *data, const char *lxcpath,
- bool backgrounded)
+ bool backgrounded, int *error_num)
{
int ret, status;
struct lxc_conf *conf = handler->conf;
lxc_monitor_send_exit_code(name, status, handler->lxcpath);
lxc_error_set_and_log(handler->pid, status);
+ if (error_num)
+ *error_num = handler->exit_status;
out_fini:
lxc_delete_network(handler);
};
int lxc_start(const char *name, char *const argv[], struct lxc_handler *handler,
- const char *lxcpath, bool backgrounded)
+ const char *lxcpath, bool backgrounded, int *error_num)
{
struct start_args start_arg = {
.argv = argv,
};
- return __lxc_start(name, handler, &start_ops, &start_arg, lxcpath, backgrounded);
+ return __lxc_start(name, handler, &start_ops, &start_arg, lxcpath, backgrounded, error_num);
}
static void lxc_destroy_container_on_signal(struct lxc_handler *handler,
extern int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
int *fds_to_ignore, size_t len_fds);
extern int __lxc_start(const char *, struct lxc_handler *,
- struct lxc_operations *, void *, const char *, bool);
+ struct lxc_operations *, void *, const char *, bool,
+ int *);
extern int resolve_clone_flags(struct lxc_handler *handler);