aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2016-10-19 11:52:31 +0300
committerEryu Guan <eguan@redhat.com>2016-10-21 23:20:14 +0800
commit93d72ed7f6625958b4dccb12a42cd6953b08fbf9 (patch)
tree0c304c61015d50213a7e3482bc43f84c471913d4
parentf1edd77ebc28f95d97184faa570137f79ef2941c (diff)
downloadxfstests-dev-93d72ed7f6625958b4dccb12a42cd6953b08fbf9.tar.gz
t_truncate_self: describe self better in error message
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> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
-rw-r--r--src/t_truncate_self.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/t_truncate_self.c b/src/t_truncate_self.c
index d14dec397e..3f1c8e6fde 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;
}