From 267bc7eda8443c3a985e5b82289ab1ed533f2e16 Mon Sep 17 00:00:00 2001 From: 0x0916 Date: Sat, 1 Jul 2017 14:04:14 +0800 Subject: [PATCH] lxc-monitord: exit when got a quit command lxc-monitor has an option to tell lxc-monitord to quit. ``` ~/lxc (master) # lxc-monitor --help lxc-monitor monitors the state of the NAME container Options : -n, --name=NAME NAME of the container NAME may be a regular expression -Q, --quit tell lxc-monitord to quit ``` But it does not work. This patch fix that. Signed-off-by: 0x0916 --- src/lxc/lxc_monitord.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lxc/lxc_monitord.c b/src/lxc/lxc_monitord.c index 456c4fc94..c4c2ba0d1 100644 --- a/src/lxc/lxc_monitord.c +++ b/src/lxc/lxc_monitord.c @@ -430,10 +430,18 @@ int main(int argc, char *argv[]) getpid(), mon.lxcpath); for (;;) { ret = lxc_mainloop(&mon.descr, 1000 * 30); + if (ret) { + ERROR("mainloop returned an error"); + break; + } if (mon.clientfds_cnt <= 0) { NOTICE("No remaining clients. lxc-monitord is exiting."); break; } + if (quit == 1) { + NOTICE("got quit command. lxc-monitord is exitting."); + break; + } } on_signal: -- 2.47.2