mtree -c: Fix username logic when getlogin(3) fails.
Obtained from: NetBSD (Credit to Sascha Wildner with DragonFlyBSD) MFC after: 2 weeks
This commit is contained in:
parent
4f4b548b1d
commit
09c9ed3b05
@ -117,7 +117,7 @@ cwalk(FILE *fp)
|
||||
host[sizeof(host) - 1] = '\0';
|
||||
if ((user = getlogin()) == NULL) {
|
||||
struct passwd *pw;
|
||||
user = (pw = getpwuid(getuid())) == NULL ? pw->pw_name :
|
||||
user = (pw = getpwuid(getuid())) != NULL ? pw->pw_name :
|
||||
"<unknown>";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user