From 3ef1a87d0a29eac94f32371af628e81eb2e2d817 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 18 Aug 2025 17:00:26 +1000 Subject: [PATCH] Fix pledge(2) special casing Unbreaks non-OpenBSD platforms --- configure.ac | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index bc1900af7..71766ba10 100644 --- a/configure.ac +++ b/configure.ac @@ -629,6 +629,9 @@ SOLARIS_PRIVS="no" # Default shared library extension SHLIBEXT=".so" +# See OpenBSD section in $host case below. +need_pledge_inet="" + # Check for some target-specific stuff case "$host" in *-*-aix*) @@ -1129,7 +1132,6 @@ mips-sony-bsd|mips-sony-newsos4) [syslog_r function is safe to use in in a signal handler]) TEST_MALLOC_OPTIONS="SJRU" AC_MSG_CHECKING([whether pledge(2) allows IP_TOS]) - need_pledge_inet="" AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include @@ -1151,12 +1153,6 @@ if (setsockopt(s, IPPROTO_IP, IP_TOS, &one, sizeof(one)) == -1) need_pledge_inet=1 ], [ AC_MSG_WARN([cross compiling: cannot test]) ]) - if test -z "$need_pledge_inet" ; then - AC_DEFINE_UNQUOTED([PLEDGE_EXTRA_INET], []) - else - AC_DEFINE_UNQUOTED([PLEDGE_EXTRA_INET], ["inet "], - [need inet in pledge for setsockopt IP_TOS]) - fi ;; *-*-solaris*) if test "x$withval" != "xno" ; then @@ -1430,6 +1426,14 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ exit(0); ]])], [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ] ) +dnl Finish up special pledge(2) handling from above. +if test -z "$need_pledge_inet" ; then + AC_DEFINE_UNQUOTED([PLEDGE_EXTRA_INET], []) +else + AC_DEFINE_UNQUOTED([PLEDGE_EXTRA_INET], ["inet "], + [need inet in pledge for setsockopt IP_TOS]) +fi + dnl Checks for header files. # Checks for libraries. AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])]) -- 2.47.2