summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libc/gen/glob.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index 0c6fe5d..df3cbc2 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -363,10 +363,12 @@ globtilde(pattern, patbuf, patbuf_len, pglob)
* the password file
*/
if (issetugid() != 0 || (h = getenv("HOME")) == NULL) {
- if ((pwd = getpwuid(getuid())) == NULL)
- return pattern;
- else
+ if (((h = getlogin()) != NULL &&
+ (pwd = getpwnam(h)) != NULL) ||
+ (pwd = getpwuid(getuid())) != NULL)
h = pwd->pw_dir;
+ else
+ return pattern;
}
}
else {
OpenPOWER on IntegriCloud