linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>, Eryu Guan <eguan@redhat.com>,
	Xiong Zhou <xzhou@redhat.com>
Cc: linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 1/3] t_truncate_self: describe self better in error message
Date: Wed, 19 Oct 2016 11:52:31 +0300	[thread overview]
Message-ID: <1476867153-17368-1-git-send-email-amir73il@gmail.com> (raw)

Include the name of the program that is trying to trucate itself
to error messages to distinguish between output for different
test cases (e.g. test_lower and test_upper in overlay/013).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 src/t_truncate_self.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/t_truncate_self.c b/src/t_truncate_self.c
index d14dec3..3f1c8e6 100644
--- a/src/t_truncate_self.c
+++ b/src/t_truncate_self.c
@@ -1,18 +1,21 @@
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
+#include <libgen.h>
 
 int main(int argc, char *argv[])
 {
+	const char *progname = basename(argv[0]);
 	int ret;
 
 	ret = truncate(argv[0], 4096);
 	if (ret != -1) {
-		fprintf(stderr, "truncate(argv[0]) should have failed\n");
+		fprintf(stderr, "truncate(%s) should have failed\n",
+			progname);
 		return 1;
 	}
 	if (errno != ETXTBSY) {
-		perror("truncate(argv[0])");
+		perror(progname);
 		return 1;
 	}
 
-- 
2.7.4

             reply	other threads:[~2016-10-19  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  8:52 Amir Goldstein [this message]
2016-10-19  8:52 ` [PATCH 2/3] overlay/013: fix bug in test_upper creation Amir Goldstein
2016-10-19  8:52 ` [PATCH 3/3] overlay/013: adjust test expectation to kernel v4.8 Amir Goldstein

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=1476867153-17368-1-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=xzhou@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).