summary refs log tree commit diff
path: root/src/expand.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-05-27 17:31:57 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-08-29 11:15:57 +0800
commit14dff0f69d37e73cf99c77f5f5f38b2a3c6522f5 (patch)
tree9c34d9aa1cde316079d6a833b13b254bbad0eefa /src/expand.c
parentshell: Don't include config.h for native helpers (diff)
downloaddash-14dff0f69d37e73cf99c77f5f5f38b2a3c6522f5.tar.gz
dash-14dff0f69d37e73cf99c77f5f5f38b2a3c6522f5.zip
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 <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--src/expand.c2
1 files changed, 1 insertions, 1 deletions
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);