From: 0x0916 Date: Sat, 1 Jul 2017 06:04:14 +0000 (+0800) Subject: lxc-monitord: exit when got a quit command X-Git-Tag: lxc-2.1.0~77^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1662%2Fhead;p=thirdparty%2Flxc.git 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 --- 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: