From: Denys Vlasenko Date: Sun, 16 Feb 2020 17:31:05 +0000 (+0100) Subject: ash: expand: Use HOME in tilde expansion when it is empty X-Git-Tag: 1_32_0~75 X-Git-Url: https://git.librecmc.org/?p=oweals%2Fbusybox.git;a=commitdiff_plain;h=e880b1fea8442b623d45a8f62227fc35cbcac7ec ash: expand: Use HOME in tilde expansion when it is empty Upstream commit: Date: Sun, 27 May 2018 17:31:57 +0800 expand: Use HOME in tilde expansion when it is empty Currently if HOME is set to empty tilde expansion will fail, i.e., it will remain as a literal tilde. This patch changes it to return the empty string as required by POSIX. Signed-off-by: Herbert Xu Signed-off-by: Denys Vlasenko --- diff --git a/shell/ash.c b/shell/ash.c index 78ca1d99c..138f19abd 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -6440,7 +6440,7 @@ exptilde(char *startp, char *p, int flags) goto lose; home = pw->pw_dir; } - if (!home || !*home) + if (!home) goto lose; *p = c; strtodest(home, SQSYNTAX, quotes);