diff mbox

expand: Use HOME in tilde expansion when it is empty

Message ID 20180527093157.pv3kuywvflnop6bc@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Herbert Xu May 27, 2018, 9:31 a.m. UTC
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 <herbert@gondor.apana.org.au>
diff mbox

Patch

diff --git a/src/expand.c b/src/expand.c
index 45e9b79..eb50e15 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -385,7 +385,7 @@  done:
 	} else {
 		home = getpwhome(name);
 	}
-	if (!home || !*home)
+	if (!home)
 		goto lose;
 	*p = c;
 	strtodest(home, SQSYNTAX, quotes);