diff options
author | ache <ache@FreeBSD.org> | 1997-08-27 13:36:34 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-08-27 13:36:34 +0000 |
commit | dbbb9f298faa7b02bf158d5d4402f1a3b5739632 (patch) | |
tree | 1acc3fe6ee2f646501fd5b65e21175e3cced7f99 /lib/libc/gen/glob.c | |
parent | cb8d9886a95f231d2aed4570a64cf386dc69d068 (diff) | |
download | FreeBSD-src-dbbb9f298faa7b02bf158d5d4402f1a3b5739632.zip FreeBSD-src-dbbb9f298faa7b02bf158d5d4402f1a3b5739632.tar.gz |
Use getpwnam(getlogin()) before getpwuid(getuid())
Diffstat (limited to 'lib/libc/gen/glob.c')
-rw-r--r-- | lib/libc/gen/glob.c | 8 |
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 { |