gh-127081: use getlogin_r if available (gh-132751)

The `getlogin` function is not thread-safe: replace with `getlogin_r` where
available.
This commit is contained in:
Duane Griffin 2025-06-04 05:28:58 +12:00 committed by GitHub
parent 54ca55978e
commit 1ffe913c20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 79 additions and 1 deletions

View file

@ -5219,7 +5219,7 @@ AC_CHECK_FUNCS([ \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin \
getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin getlogin_r \
getpeername getpgid getpid getppid getpriority _getpty \
getpwent getpwnam_r getpwuid getpwuid_r getresgid getresuid getrusage getsid getspent \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
@ -5538,6 +5538,18 @@ PY_CHECK_FUNC([setgroups], [
#endif
])
AC_CHECK_DECL([MAXLOGNAME],
[AC_DEFINE([HAVE_MAXLOGNAME], [1],
[Define if you have the 'MAXLOGNAME' constant.])],
[],
[@%:@include <sys/params.h>])
AC_CHECK_DECLS([UT_NAMESIZE],
[AC_DEFINE([HAVE_UT_NAMESIZE], [1],
[Define if you have the 'HAVE_UT_NAMESIZE' constant.])],
[],
[@%:@include <utmp.h>])
# check for openpty, login_tty, and forkpty
AC_CHECK_FUNCS([openpty], [],