From: Todd C. Miller Date: Tue, 30 Aug 2011 14:09:46 +0000 (-0400) Subject: Add configure test for missing errno declaration and only X-Git-Tag: SUDO_1_7_8~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cd6542c6a60a9b1b2075f49afc46d8a2d1d2ac5;p=sudo Add configure test for missing errno declaration and only declare it ourselves if it is missing. --HG-- branch : 1.7 --- diff --git a/config.h.in b/config.h.in index cf8b23343..7f00536a8 100644 --- a/config.h.in +++ b/config.h.in @@ -79,6 +79,10 @@ /* Define to 1 if your `DIR' contains dd_fd. */ #undef HAVE_DD_FD +/* Define to 1 if you have the declaration of `errno', and to 0 if you don't. + */ +#undef HAVE_DECL_ERRNO + /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #undef HAVE_DECL_SYS_SIGLIST diff --git a/configure b/configure index fcee4a33d..7f8bdfe1b 100755 --- a/configure +++ b/configure @@ -17441,6 +17441,22 @@ fi done +ac_fn_c_check_decl "$LINENO" "errno" "ac_cv_have_decl_errno" " +$ac_includes_default +#include + +" +if test "x$ac_cv_have_decl_errno" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ERRNO $ac_have_decl +_ACEOF + + for ac_func in strsignal do : ac_fn_c_check_func "$LINENO" "strsignal" "ac_cv_func_strsignal" diff --git a/configure.in b/configure.in index 640785658..b24fc5454 100644 --- a/configure.in +++ b/configure.in @@ -2139,6 +2139,14 @@ AC_CHECK_FUNCS(getprogname, , [ AC_MSG_RESULT($sudo_cv___progname) ]) +dnl +dnl Check for errno declaration in errno.h +dnl +AC_CHECK_DECLS([errno], [], [], [ +AC_INCLUDES_DEFAULT +#include +]) + dnl dnl Check for strsignal() or sys_siglist dnl diff --git a/missing.h b/missing.h index 7b2d29d1b..8b2a13c33 100644 --- a/missing.h +++ b/missing.h @@ -266,6 +266,13 @@ const char *getprogname __P((void)); #endif /* HAVE___PROGNAME */ #endif /* !HAVE_GETPROGNAME */ +/* + * Declare errno if errno.h doesn't do it for us. + */ +#if defined(HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +extern int errno; +#endif /* !HAVE_DECL_ERRNO */ + #ifndef timevalclear # define timevalclear(tv) ((tv)->tv_sec = (tv)->tv_usec = 0) #endif diff --git a/sudo.h b/sudo.h index a59677b3e..8fe4a6bed 100644 --- a/sudo.h +++ b/sudo.h @@ -365,8 +365,5 @@ extern uid_t timestamp_uid; /* XXX - conflicts with the one in visudo */ int run_command __P((const char *path, char *argv[], char *envp[], uid_t uid, int dowait)); #endif -#ifndef errno -extern int errno; -#endif #endif /* _SUDO_SUDO_H */ diff --git a/sudo_noexec.c b/sudo_noexec.c index ba180b5d0..127fcbed4 100644 --- a/sudo_noexec.c +++ b/sudo_noexec.c @@ -38,10 +38,6 @@ * few programs actually do that. */ -#ifndef errno -extern int errno; -#endif - #define DUMMY_BODY \ { \ errno = EACCES; \