blkrawverify: warn and return error if no traces are found
PATCH 1/1 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
---
Index: blktrace/blkrawverify.c =================================--- blktrace.orig/blkrawverify.c +++ blktrace/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) {