]> granicus.if.org Git - sudo/commitdiff
Detect sys_sigabbrev[] and use it in place of sys_signame[] if
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Aug 2012 14:11:38 +0000 (10:11 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Aug 2012 14:11:38 +0000 (10:11 -0400)
present.  For some reason glibc does not declare sys_sigabbrev so
we must add an extern definition of our own.

compat/strsigname.c
config.h.in
configure
configure.in

index 6194724ff9e98cebc587eae5bc9f4cb7812e05d5..3470c7efbcc17e3fbe01388f5c83c107f79c35a2 100644 (file)
 # define sudo_sys_signame      _sys_signame
 #elif defined(HAVE_DECL___SYS_SIGNAME) && HAVE_DECL___SYS_SIGNAME == 1
 # define sudo_sys_signame      __sys_signame
+#elif defined(HAVE_DECL_SYS_SIGABBREV) && HAVE_DECL_SYS_SIGABBREV == 1
+# define sudo_sys_signame      sys_sigabbrev
 #else
+# ifdef HAVE_SYS_SIGABBREV
+   /* sys_sigabbrev is not declared by glibc */
+#  define sudo_sys_signame     sys_sigabbrev
+# endif
 extern const char *const sudo_sys_signame[NSIG];
 #endif
 
index a05208ea4160ac53cb79888c78d4d80e3d6b09ee..9f7990dad3e83779c711e2baffe5c1a25b418f6a 100644 (file)
    don't. */
 #undef HAVE_DECL_H_ERRNO
 
+/* Define to 1 if you have the declaration of `sys_sigabbrev', and to 0 if you
+   don't. */
+#undef HAVE_DECL_SYS_SIGABBREV
+
 /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
    don't. */
 #undef HAVE_DECL_SYS_SIGLIST
 /* Define to 1 if you have the <sys/select.h> header file. */
 #undef HAVE_SYS_SELECT_H
 
+/* Define to 1 if your libc has the `sys_sigabbrev' symbol. */
+#undef HAVE_SYS_SIGABBREV
+
 /* Define to 1 if you have the <sys/sockio.h> header file. */
 #undef HAVE_SYS_SOCKIO_H
 
index 73867656b4060f7bf610678dd6638140b722507e..7a2748a25970a4bf0697eab3cecd2238cec93d1a 100755 (executable)
--- a/configure
+++ b/configure
@@ -18385,15 +18385,69 @@ if test $ac_have_decl = 1; then :
        HAVE_SIGNAME="true"
        break
 
+fi
+ac_fn_c_check_decl "$LINENO" "sys_sigabbrev" "ac_cv_have_decl_sys_sigabbrev" "
+$ac_includes_default
+#include <signal.h>
+
+"
+if test "x$ac_cv_have_decl_sys_sigabbrev" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_SIGABBREV $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+
+       HAVE_SIGNAME="true"
+       break
+
 fi
 
     if test "$HAVE_SIGNAME" != "true"; then
-       case " $LIBOBJS " in
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for undeclared sys_sigabbrev" >&5
+$as_echo_n "checking for undeclared sys_sigabbrev... " >&6; }
+if ${sudo_cv_var_sys_sigabbrev+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+extern char **sys_sigabbrev;
+int
+main ()
+{
+return sys_sigabbrev[1];
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  sudo_cv_var_sys_sigabbrev=yes
+else
+  sudo_cv_var_sys_sigabbrev=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_sys_sigabbrev" >&5
+$as_echo "$sudo_cv_var_sys_sigabbrev" >&6; }
+       if test "$sudo_cv_var_sys_sigabbrev" = yes; then
+           $as_echo "#define HAVE_SYS_SIGABBREV 1" >>confdefs.h
+
+       else
+           case " $LIBOBJS " in
   *" signame.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS signame.$ac_objext"
  ;;
 esac
 
+       fi
     fi
 
 fi
@@ -23246,5 +23300,6 @@ fi
 
 
 
+
 
 
index 43ec11d4f1dd05e699d1578801b14ac0f0ae0a9f..ce27db9b821913f9f29a889527d5aea3b45032fe 100644 (file)
@@ -2574,7 +2574,7 @@ dnl
 AC_CHECK_FUNCS(strsigname, [], [
     AC_LIBOBJ(strsigname)
     HAVE_SIGNAME="false"
-    AC_CHECK_DECLS([sys_signame, _sys_signame, __sys_signame], [
+    AC_CHECK_DECLS([sys_signame, _sys_signame, __sys_signame, sys_sigabbrev], [
        HAVE_SIGNAME="true"
        break
     ], [ ], [
@@ -2582,7 +2582,20 @@ AC_INCLUDES_DEFAULT
 #include <signal.h>
     ])
     if test "$HAVE_SIGNAME" != "true"; then
-       AC_LIBOBJ(signame)
+       AC_CACHE_CHECK([for undeclared sys_sigabbrev],
+           [sudo_cv_var_sys_sigabbrev],
+           [AC_LINK_IFELSE(
+               [AC_LANG_PROGRAM([[extern char **sys_sigabbrev;]], [[return sys_sigabbrev[1];]])],
+                   [sudo_cv_var_sys_sigabbrev=yes],
+                   [sudo_cv_var_sys_sigabbrev=no]
+               )
+           ]
+       )
+       if test "$sudo_cv_var_sys_sigabbrev" = yes; then
+           AC_DEFINE(HAVE_SYS_SIGABBREV)
+       else
+           AC_LIBOBJ(signame)
+       fi
     fi
 ])
 
@@ -3627,6 +3640,7 @@ AH_TEMPLATE(RTLD_PRELOAD_ENABLE_VAR, [An extra environment variable that is requ
 AH_TEMPLATE(RTLD_PRELOAD_DELIM, [The delimiter to use when defining multiple preloaded objects.])
 AH_TEMPLATE(RTLD_PRELOAD_DEFAULT, [The default value of preloaded objects (if any).])
 AH_TEMPLATE(HAVE_DSO_VISIBILITY, [Define to 1 if the compiler supports the __visibility__ attribute.])
+AH_TEMPLATE(HAVE_SYS_SIGABBREV, [Define to 1 if your libc has the `sys_sigabbrev' symbol.])
 
 dnl
 dnl Bits to copy verbatim into config.h.in