From 9122b2c9b1b29c88a3183e553c0bd90e8dfc911c Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 14 Jun 2016 12:12:25 +0200 Subject: [PATCH] lldpcli: fix watch return code When watch terminates normally (after hitting a limit), ensure lldpcli exits with status code 0. --- src/client/show.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client/show.c b/src/client/show.c index 57fc8b20..fa704b86 100644 --- a/src/client/show.c +++ b/src/client/show.c @@ -187,7 +187,6 @@ static int cmd_watch_neighbors(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_env *env, void *arg) { - int watch = 1; struct watcharg wa = { .env = env, .w = w, @@ -211,14 +210,14 @@ cmd_watch_neighbors(struct lldpctl_conn_t *conn, struct writer *w, lldpctl_last_strerror(conn)); return 0; } - while (watch) { + while (1) { if (lldpctl_watch(conn) < 0) { log_warnx("lldpctl", "unable to watch for neighbors. %s", lldpctl_last_strerror(conn)); - watch = 0; + return 0; } if (limit > 0 && wa.nb >= limit) - watch = 0; + return 1; } return 0; } -- 2.39.5