From: Vincent Bernat Date: Tue, 14 Jun 2016 10:12:25 +0000 (+0200) Subject: lldpcli: fix watch return code X-Git-Tag: 0.9.4~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9122b2c9b1b29c88a3183e553c0bd90e8dfc911c;p=thirdparty%2Flldpd.git lldpcli: fix watch return code When watch terminates normally (after hitting a limit), ensure lldpcli exits with status code 0. --- 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; }