Skip to content

Commit

Permalink
MFC: try getpwnam(getlogin()) before getpwuid(getuid())
Browse files Browse the repository at this point in the history
  • Loading branch information
ache authored and ache committed Aug 28, 1997
1 parent 377261b commit d488c3e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/libc/gen/glob.c
Original file line number Diff line number Diff line change
@@ -363,10 +363,12 @@ globtilde(pattern, patbuf, patbuf_len, pglob)
*/
if (getuid() != geteuid() || getgid() != getegid() ||
(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 {

0 comments on commit d488c3e

Please sign in to comment.