From 93d72ed7f6625958b4dccb12a42cd6953b08fbf9 Mon Sep 17 00:00:00 2001 From: Amir Goldstein Date: Wed, 19 Oct 2016 11:52:31 +0300 Subject: [PATCH] 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 Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- 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 d14dec39..3f1c8e6f 100644 --- a/src/t_truncate_self.c +++ b/src/t_truncate_self.c @@ -1,18 +1,21 @@ #include #include #include +#include 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.39.5