From eb8eee5a55b7688d611324da26df99c4e2292e60 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 27 Aug 1997 13:36:34 +0000 Subject: [PATCH] Use getpwnam(getlogin()) before getpwuid(getuid()) --- lib/libc/gen/glob.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index 0c6fe5ddca0..df3cbc26c89 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 {