[master] 60cd957 More coverity nitpickery

Poul-Henning Kamp phk at FreeBSD.org
Wed Jan 18 14:57:05 CET 2017


commit 60cd957279ca9aed9b1e2b59492e533e9fbff9da
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 18 13:45:01 2017 +0000

    More coverity nitpickery

diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index f587db4..4c22994 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -358,7 +358,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 		// Lck_CondWait
 		ts.tv_nsec = (long)(modf(when, &t) * 1e9);
 		ts.tv_sec = (long)t;
-		(void)pthread_cond_timedwait(&timebend_cv, &mtx, &ts);
+		i = pthread_cond_timedwait(&timebend_cv, &mtx, &ts);
+		assert(i == 0 || i == ETIMEDOUT);
 	}
 	AZ(pthread_mutex_unlock(&mtx));
 
@@ -444,7 +445,7 @@ do_curses(void *arg)
 		}
 
 		if (ch == '<' || ch == '>') {
-			pthread_mutex_lock(&mtx);
+			AZ(pthread_mutex_lock(&mtx));
 			vsl_to = vsl_t0 = vsl_ts;
 			t0 = VTIM_mono();
 			if (timebend == 0)
@@ -453,8 +454,8 @@ do_curses(void *arg)
 				timebend /= 2;
 			else
 				timebend *= 2;
-			pthread_cond_broadcast(&timebend_cv);
-			pthread_mutex_unlock(&mtx);
+			AZ(pthread_cond_broadcast(&timebend_cv));
+			AZ(pthread_mutex_unlock(&mtx));
 		}
 	}
 	NEEDLESS(pthread_exit(NULL));
@@ -462,7 +463,7 @@ do_curses(void *arg)
 
 /*--------------------------------------------------------------------*/
 
-static void
+static void __attribute__((__noreturn__))
 usage(int status)
 {
 	const char **opt;
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index b6e68cb..2e0f14e 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -158,7 +158,7 @@ static struct ctx {
 	int32_t			vxid;
 } CTX;
 
-static void
+static void __attribute__((__noreturn__))
 usage(int status)
 {
 	const char **opt;
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index f6a005c..7addb28 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -310,7 +310,7 @@ dump(void)
 	}
 }
 
-static void
+static void __attribute__((__noreturn__))
 usage(int status)
 {
 	const char **opt;



More information about the varnish-commit mailing list