From 9faddd482356f159776a024de3df1a29dfd4fd83 Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Fri, 7 Feb 2025 14:33:48 +0300 Subject: [PATCH] skip trailing spaces from cmdline Some programs do not tolerate trailing spaces in argv[0], which was happening in loadfix/lh commands. --- src/command.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/command.c b/src/command.c index f2ec8e8..eb3b7e3 100644 --- a/src/command.c +++ b/src/command.c @@ -4360,6 +4360,10 @@ static void parse_cmd_line(void) extr = cmd_line; while (*extr == ' ' || *extr == '\t') extr++; + // skip trailing spaces + delim = extr + strlen(extr) - 1; + while (delim >= extr && *delim == ' ') + *delim-- = '\0'; if (*extr == '\0') { cmd[0] = '\0';