expand: Use HOME in tilde expansion when it is empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>

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);
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux