Skip to content

Commit

Permalink
skip trailing spaces from cmdline
Browse files Browse the repository at this point in the history
Some programs do not tolerate trailing spaces in argv[0], which
was happening in loadfix/lh commands.
  • Loading branch information
stsp committed Feb 7, 2025
1 parent 1ce86ce commit 9faddd4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 9faddd4

Please sign in to comment.