From db26b1cf58aab63c39fd5665590cad3cb75eab72 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 16 Sep 2019 15:31:57 -0400
Subject: [PATCH] commit bash-20190913 snapshot

---
 configure    | 24 +++++++++++++-----------
 configure.ac |  5 ++++-
 shell.c      |  4 ++--
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index b3321c9..0a71708 100755
--- a/configure
+++ b/configure
@@ -10281,17 +10281,6 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_SETREGID $ac_have_decl
 _ACEOF
 
-ac_fn_c_check_decl "$LINENO" "" "ac_cv_have_decl_" "$ac_includes_default"
-if test "x$ac_cv_have_decl_" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_ $ac_have_decl
-_ACEOF
-(setresuid, setresgid)
 ac_fn_c_check_decl "$LINENO" "strcpy" "ac_cv_have_decl_strcpy" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strcpy" = xyes; then :
   ac_have_decl=1
@@ -10315,6 +10304,19 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+for ac_func in setresuid setresgid
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
 ac_fn_c_check_decl "$LINENO" "strtold" "ac_cv_have_decl_strtold" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtold" = xyes; then :
   ac_have_decl=1
diff --git a/configure.ac b/configure.ac
index f62a747..9a847bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -810,10 +810,13 @@ AC_CHECK_DECLS([confstr])
 AC_CHECK_DECLS([printf])
 AC_CHECK_DECLS([sbrk])
 AC_CHECK_DECLS([setregid])
-AC_CHECK_DECLS[(setresuid, setresgid])
+dnl AC_CHECK_DECLS[(setresuid])
+dnl AC_CHECK_DECLS[(setresgid])
 AC_CHECK_DECLS([strcpy])
 AC_CHECK_DECLS([strsignal])
 
+AC_CHECK_FUNCS(setresuid setresgid)
+
 dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
 AC_CHECK_DECLS([strtold], [
     AC_MSG_CHECKING([for broken strtold])
diff --git a/shell.c b/shell.c
index 6adabc8..035a13c 100644
--- a/shell.c
+++ b/shell.c
@@ -1293,7 +1293,7 @@ disable_priv_mode ()
 {
   int e;
 
-#if HAVE_DECL_SETRESUID
+#if HAVE_SETRESUID
   if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0)
 #else
   if (setuid (current_user.uid) < 0)
@@ -1306,7 +1306,7 @@ disable_priv_mode ()
 	exit (e);
 #endif
     }
-#if HAVE_DECL_SETRESGID
+#if HAVE_SETRESGID
   if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0)
 #else
   if (setgid (current_user.gid) < 0)
-- 
2.19.1

