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

33
configure generated vendored
View file

@ -19458,6 +19458,12 @@ if test "x$ac_cv_func_getlogin" = xyes
then :
printf "%s\n" "#define HAVE_GETLOGIN 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "getlogin_r" "ac_cv_func_getlogin_r"
if test "x$ac_cv_func_getlogin_r" = xyes
then :
printf "%s\n" "#define HAVE_GETLOGIN_R 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "getpeername" "ac_cv_func_getpeername"
if test "x$ac_cv_func_getpeername" = xyes
@ -23843,6 +23849,33 @@ fi
ac_fn_check_decl "$LINENO" "MAXLOGNAME" "ac_cv_have_decl_MAXLOGNAME" "#include <sys/params.h>
" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_MAXLOGNAME" = xyes
then :
printf "%s\n" "#define HAVE_MAXLOGNAME 1" >>confdefs.h
fi
ac_fn_check_decl "$LINENO" "UT_NAMESIZE" "ac_cv_have_decl_UT_NAMESIZE" "#include <utmp.h>
" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_UT_NAMESIZE" = xyes
then :
ac_have_decl=1
else case e in #(
e) ac_have_decl=0 ;;
esac
fi
printf "%s\n" "#define HAVE_DECL_UT_NAMESIZE $ac_have_decl" >>confdefs.h
if test $ac_have_decl = 1
then :
printf "%s\n" "#define HAVE_UT_NAMESIZE 1" >>confdefs.h
fi
# check for openpty, login_tty, and forkpty