1
0
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:
Simon Tatham
2019-03-26 19:03:15 +00:00
parent 235f5bf8ae
commit 9375d1325f
2 changed files with 5 additions and 1 deletions

View File

@ -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);
}