Here's another fix.
In adjusting the printf, I added a cast and switched to %5ld.
I would have preferred to use %5jd as the printf format (i.e., then no
cast is needed), but saw no other uses of the "j" directive, so perhaps
you do not yet depend on printf with such support.
From 6d5d3af35d1f6851537f7af8996d1106c1ebe435 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 18 Jul 2012 17:54:38 +0200
Subject: [PATCH] tests/rbwriter: don't ignore write failure
Spotted by coverity:
This less-than-zero comparison of an unsigned value is never true.
"res < 0U".
http://libqb.org/html/0.14.1/coverity/1/7rbwriter.c.html#error
---
tests/rbwriter.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/rbwriter.c b/tests/rbwriter.c
index 616a6c1..5d0cf5f 100644
--- a/tests/rbwriter.c
+++ b/tests/rbwriter.c
@@ -65,10 +65,10 @@ static void sigterm_handler(int32_t num)
}
static void
-_benchmark(int write_size)
+_benchmark(ssize_t write_size)
{
struct timeval tv1, tv2, tv_elapsed;
- unsigned int res;
+ ssize_t res;
int write_count = 0;
alarm_notice = 0;
@@ -89,7 +89,7 @@ _benchmark(int write_size)
timersub (&tv2, &tv1, &tv_elapsed);
printf ("%5d messages sent ", write_count);
- printf ("%5d bytes per write ", write_size);
+ printf ("%5ld bytes per write ", (long int) write_size);
printf ("%7.3f Seconds runtime ",
(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
printf ("%9.3f TP/s ",
--
1.7.11.2.194.g7bdb748