From 6d4476258993d82a14ec060c53e41199d2f5eef5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 9 Aug 2025 02:24:56 +0200 Subject: ash: options: Do not set commandname in procargs Upstream commit: Date: Mon Feb 25 12:49:20 2019 +0800 options: Do not set commandname in procargs We set commandname in procargs when we don't have to. This results in a duplicated output of arg0 when an error occurs. function old new delta ash_main 1256 1236 -20 Signed-off-by: Denys Vlasenko --- shell/ash.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index e8ac07cf0..aaea641a9 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -1447,7 +1447,7 @@ ash_vmsg(const char *msg, va_list ap) { fprintf(stderr, "%s: ", arg0); if (commandname) { - if (strcmp(arg0, commandname)) + if (strcmp(arg0, commandname) != 0) fprintf(stderr, "%s: ", commandname); if (!iflag || g_parsefile->pf_fd > 0) fprintf(stderr, "line %d: ", errlinno); @@ -14659,7 +14659,7 @@ procargs(char **argv) int login_sh; xargv = argv; - login_sh = xargv[0] && xargv[0][0] == '-'; + login_sh = /*xargv[0] &&*/ xargv[0][0] == '-'; #if NUM_SCRIPTS > 0 if (minusc) goto setarg0; @@ -14705,7 +14705,6 @@ procargs(char **argv) setinputfile(*xargv, 0); setarg0: arg0 = *xargv++; - commandname = arg0; } shellparam.p = xargv; -- cgit v1.2.3-55-g6feb