ip a flush: unnecessarily chatty when there's nothing to flush
On tis, 2008-07-22 at 20:21 +0200, martin f krafft wrote:
> piper:~|master|% sudo ip a flush dev eth0 >/dev/null
> Nothing to flush.
>
> It should just shut up, shouldn't it? :)
The patch below makes the "Nothing to flush" only visible when show
statistics flag is given, and then only to stdout rather then stderr.
$ sudo ./ip/ip -s addr flush dev skif
Nothing to flush.
$ sudo ./ip/ip addr flush dev skif
$
(See http://bugs.debian.org/492196 )
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index fa0e41d..30c7c72 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -402,10 +402,12 @@
exit(1);
}
if (filter.flushed == 0) {
- if (round == 0) {
- fprintf(stderr, "Nothing to flush.\n");
- } else if (show_stats)
- printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":"");
+ if (show_stats) {
+ if (round == 0)
+ printf("Nothing to flush.\n");
+ else
+ printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":"");
+ }
fflush(stdout);
return 0;
}