All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-btrace@vger.kernel.org
Subject: [PATCH] blkrawverify: warn and return error if no traces are found
Date: Thu, 07 May 2009 16:08:25 +0000	[thread overview]
Message-ID: <4A030779.7090707@redhat.com> (raw)

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@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

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


                 reply	other threads:[~2009-05-07 16:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A030779.7090707@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-btrace@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.