svn commit: r262766 - head/tools/tools/iwn/iwnstats

Eitan Adler eadler at FreeBSD.org
Wed Mar 5 01:41:11 UTC 2014


Author: eadler
Date: Wed Mar  5 01:41:10 2014
New Revision: 262766
URL: http://svnweb.freebsd.org/changeset/base/262766

Log:
  If the device doesn't exist when iwnstats starts running don't spam the console
  forever.

Modified:
  head/tools/tools/iwn/iwnstats/main.c

Modified: head/tools/tools/iwn/iwnstats/main.c
==============================================================================
--- head/tools/tools/iwn/iwnstats/main.c	Wed Mar  5 01:34:10 2014	(r262765)
+++ head/tools/tools/iwn/iwnstats/main.c	Wed Mar  5 01:41:10 2014	(r262766)
@@ -29,6 +29,7 @@
  * $FreeBSD$
  */
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
@@ -267,6 +268,7 @@ main(int argc, char *argv[])
 	struct iwnstats *is;
 	int ch;
 	char *ifname;
+	bool first;
 
 	ifname = strdup(IWN_DEFAULT_IF);
 
@@ -296,9 +298,12 @@ main(int argc, char *argv[])
 	}
 
 	/* begin fetching data */
+	first = true;
 	while (1) {
 		if (iwn_collect(is) != 0) {
 			fprintf(stderr, "%s: fetch failed\n", argv[0]);
+			if (first)
+				return 1;
 			goto next;
 		}
 
@@ -306,6 +311,7 @@ main(int argc, char *argv[])
 
 	next:
 		usleep(100 * 1000);
+		first = false;
 	}
 
 	exit(0);


More information about the svn-src-all mailing list