From: Eric Sandeen Date: Thu, 7 May 2009 16:08:25 +0000 (-0500) Subject: blkrawverify: warn and return error if no traces are found X-Git-Tag: blktrace-1.0.1~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=420c2b7629ca7f7c81896652edb93c3a97c87c4c;p=blktrace.git blkrawverify: warn and return error if no traces are found blkrawverify is prints no errors and returns success if the requested tracefiles aren't found: # blkrawverify foobar Verifying foobar # echo $? 0 With this change it's a bit more informative: # ./blkrawverify foobar Verifying foobar No tracefiles found for foobar # echo $? 1 Resolves Red Hat Bugzilla #499581 Reported-by: Milos Malik Signed-off-by: Eric Sandeen Signed-off-by: Jens Axboe --- diff --git a/blkrawverify.c b/blkrawverify.c index 984dbff..e669179 100644 --- a/blkrawverify.c +++ b/blkrawverify.c @@ -296,8 +296,14 @@ int main(int argc, char *argv[]) printf("Verifying %s\n", devname); fflush(stdout); for (cpu = 0; ; cpu++) { sprintf(fname, "%s.blktrace.%d", devname, cpu); - if (stat(fname, &st) < 0) + if (stat(fname, &st) < 0) { + if (cpu == 0) { + fprintf(stderr, "No tracefiles found for %s\n", + devname); + rval = 1; + } break; + } printf(" CPU %d ", cpu); fflush(stdout); nbad = process(&ofp, devname, fname, cpu); if (nbad) {