ash: do not truncate failed tilde expansion on unknown user names

Do not skip over "*p = c;" statement.

Testcase: echo ~~nouser/qwe

function                                             old     new   delta
argstr                                              1396    1406     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2022-03-01 10:08:59 +01:00
parent 7750b5a25a
commit 5fe20cf321

View File

@ -6532,9 +6532,7 @@ exptilde(char *startp, int flag)
home = lookupvar("HOME"); home = lookupvar("HOME");
} else { } else {
pw = getpwnam(name); pw = getpwnam(name);
if (pw == NULL) home = pw ? pw->pw_dir : NULL;
goto lose;
home = pw->pw_dir;
} }
*p = c; *p = c;
if (!home) if (!home)