From: Felix Fietkau Date: Wed, 15 Feb 2017 10:35:35 +0000 (+0100) Subject: cli: do not use default timeout for listen X-Git-Url: https://git.librecmc.org/?p=oweals%2Fubus.git;a=commitdiff_plain;h=6eb3c9647e04d38f14e6c8d3e2d9b6922f2a43d1 cli: do not use default timeout for listen Default to listening for events forever unless -t is explicitly specified on the command line Signed-off-by: Felix Fietkau --- diff --git a/cli.c b/cli.c index 624c089..1949a17 100644 --- a/cli.c +++ b/cli.c @@ -17,6 +17,7 @@ #include "libubus.h" static struct blob_buf b; +static int listen_timeout; static int timeout = 30; static bool simple_output = false; static int verbose = 0; @@ -171,7 +172,8 @@ static void do_listen(struct ubus_context *ctx, struct cli_listen_data *data) data->timeout.cb = listen_timeout; uloop_init(); ubus_add_uloop(ctx); - uloop_timeout_set(&data->timeout, timeout * 1000); + if (listen_timeout) + uloop_timeout_set(&data->timeout, listen_timeout * 1000); uloop_run(); uloop_done(); } @@ -585,6 +587,7 @@ int main(int argc, char **argv) ubus_socket = optarg; break; case 't': + listen_timeout = atoi(optarg); timeout = atoi(optarg); break; case 'S':