From: Amir Goldstein Date: Wed, 19 Oct 2016 08:52:31 +0000 (+0300) Subject: t_truncate_self: describe self better in error message X-Git-Tag: v2022.05.01~2317 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=93d72ed7f6625958b4dccb12a42cd6953b08fbf9;p=users%2Fhch%2Fxfstests-dev.git 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 --- diff --git a/src/t_truncate_self.c b/src/t_truncate_self.c index d14dec397..3f1c8e6fd 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; }