[lxc-devel] [RFC PATCH] lxc_cmd_stop_callback(): Fix return value handling of kill()
Thomas Jarosch
thomas.jarosch at intra2net.com
Sat Dec 19 16:51:35 UTC 2015
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.
---
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
More information about the lxc-devel
mailing list