[lxc-devel] [RFC PATCH] lxc_cmd_stop_callback(): Fix return value handling of kill()
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Dec 21 07:26:42 UTC 2015
Quoting Thomas Jarosch (thomas.jarosch at intra2net.com):
> kill() returns 0 on success or -1 on error.
>
> I'm not sure how frozen processes react to signal delivery,
> judging from the code below it's not possible and that's
> the reason unfreeze() is called. Please double check.
>
(no signed-off-by)
nack - we in fact want to unfreeze, and return success, only if
the kill succeeded.
> ---
> src/lxc/commands.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lxc/commands.c b/src/lxc/commands.c
> index a807da3..a7d3acc 100644
> --- a/src/lxc/commands.c
> +++ b/src/lxc/commands.c
> @@ -635,7 +635,7 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
> stopsignal = handler->conf->stopsignal;
> memset(&rsp, 0, sizeof(rsp));
> rsp.ret = kill(handler->pid, stopsignal);
> - if (!rsp.ret) {
> + if (rsp.ret < 0) {
> /* we can't just use lxc_unfreeze() since we are already in the
> * context of handling the STOP cmd in lxc-start, and calling
> * lxc_unfreeze() would do another cmd (GET_CGROUP) which would
> --
> 2.4.3
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list