mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-06 08:39:22 +00:00
Merge pull request #3010 from brauner/2019-05-17/bugfixes
lxccontainer: cleanup attach functions
This commit is contained in:
commit
ddf4b77e11
@ -4055,7 +4055,9 @@ static bool do_lxcapi_rename(struct lxc_container *c, const char *newname)
|
|||||||
|
|
||||||
WRAP_API_1(bool, lxcapi_rename, const char *)
|
WRAP_API_1(bool, lxcapi_rename, const char *)
|
||||||
|
|
||||||
static int lxcapi_attach(struct lxc_container *c, lxc_attach_exec_t exec_function, void *exec_payload, lxc_attach_options_t *options, pid_t *attached_process)
|
static int lxcapi_attach(struct lxc_container *c,
|
||||||
|
lxc_attach_exec_t exec_function, void *exec_payload,
|
||||||
|
lxc_attach_options_t *options, pid_t *attached_process)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -4064,16 +4066,20 @@ static int lxcapi_attach(struct lxc_container *c, lxc_attach_exec_t exec_functio
|
|||||||
|
|
||||||
current_config = c->lxc_conf;
|
current_config = c->lxc_conf;
|
||||||
|
|
||||||
ret = lxc_attach(c, exec_function, exec_payload, options, attached_process);
|
ret = lxc_attach(c, exec_function, exec_payload, options,
|
||||||
|
attached_process);
|
||||||
current_config = NULL;
|
current_config = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_lxcapi_attach_run_wait(struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char * const argv[])
|
static int do_lxcapi_attach_run_wait(struct lxc_container *c,
|
||||||
|
lxc_attach_options_t *options,
|
||||||
|
const char *program,
|
||||||
|
const char *const argv[])
|
||||||
{
|
{
|
||||||
lxc_attach_command_t command;
|
lxc_attach_command_t command;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int r;
|
int ret;
|
||||||
|
|
||||||
if (!c)
|
if (!c)
|
||||||
return -1;
|
return -1;
|
||||||
@ -4081,16 +4087,16 @@ static int do_lxcapi_attach_run_wait(struct lxc_container *c, lxc_attach_options
|
|||||||
command.program = (char *)program;
|
command.program = (char *)program;
|
||||||
command.argv = (char **)argv;
|
command.argv = (char **)argv;
|
||||||
|
|
||||||
r = lxc_attach(c, lxc_attach_run_command, &command, options, &pid);
|
ret = lxc_attach(c, lxc_attach_run_command, &command, options, &pid);
|
||||||
if (r < 0) {
|
if (ret < 0)
|
||||||
ERROR("ups");
|
return ret;
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return lxc_wait_for_pid_status(pid);
|
return lxc_wait_for_pid_status(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lxcapi_attach_run_wait(struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char * const argv[])
|
static int lxcapi_attach_run_wait(struct lxc_container *c,
|
||||||
|
lxc_attach_options_t *options,
|
||||||
|
const char *program, const char *const argv[])
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user