mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Autoconf workaround for lack of setpwent / endpwent.
Test-building inside Termux on Android, it seems that <pwd.h> in that environment defines the important functions getpwnam and getpwuid, but not the setpwent/endpwent with which we bookend them. Tolerate their absence.
This commit is contained in:
@ -119,7 +119,9 @@ char *get_username(void)
|
||||
* coping correctly with people who have su'ed.
|
||||
*/
|
||||
user = getlogin();
|
||||
#if HAVE_SETPWENT
|
||||
setpwent();
|
||||
#endif
|
||||
if (user)
|
||||
p = getpwnam(user);
|
||||
else
|
||||
@ -141,7 +143,9 @@ char *get_username(void)
|
||||
return NULL;
|
||||
ret = p->pw_name;
|
||||
}
|
||||
#if HAVE_ENDPWENT
|
||||
endpwent();
|
||||
#endif
|
||||
|
||||
return dupstr(ret);
|
||||
}
|
||||
|
Reference in New Issue
Block a user