]> granicus.if.org Git - sudo/commitdiff
Add configure test for missing errno declaration and only
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 30 Aug 2011 14:09:46 +0000 (10:09 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 30 Aug 2011 14:09:46 +0000 (10:09 -0400)
declare it ourselves if it is missing.

--HG--
branch : 1.7

config.h.in
configure
configure.in
missing.h
sudo.h
sudo_noexec.c

index cf8b233435053bcb64c22bebfe870c5d8223c610..7f00536a8ace538394d042f409343d6cfb90ac23 100644 (file)
 /* 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
index fcee4a33d63070a2fd160730c4cfd09807bba40b..7f8bdfe1b276d78d22ab9edfe65533490a3efa6c 100755 (executable)
--- a/configure
+++ b/configure
 done
 
 
+ac_fn_c_check_decl "$LINENO" "errno" "ac_cv_have_decl_errno" "
+$ac_includes_default
+#include <errno.h>
+
+"
+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"
index 6407856588529b9cd270abe5c34e8449920539cf..b24fc545405cc1efcfbf6256036743c00d250a46 100644 (file)
@@ -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 <errno.h>
+])
+
 dnl
 dnl Check for strsignal() or sys_siglist
 dnl
index 7b2d29d1bd78d43c1faef1c2073187daa727d9cb..8b2a13c33bfbd8884ea3b2b74618f97429732b2f 100644 (file)
--- 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 a59677b3edb30737861d3e261da4da6172222041..8fe4a6beda0315fcb58efa4b0ed749b3bc906054 100644 (file)
--- 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 */
index ba180b5d0b8d63c94cc68fd733037ef26b70e08f..127fcbed40154232c5281d3d4157ebc9db56a49c 100644 (file)
  * few programs actually do that.
  */
 
-#ifndef errno
-extern int errno;
-#endif
-
 #define DUMMY_BODY                             \
 {                                              \
     errno = EACCES;                            \