[PATCH] blkrawverify: warn and return error if no traces are found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <mmalik@xxxxxxxxxx>
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

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) {

--
To unsubscribe from this list: send the line "unsubscribe linux-btrace" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux