]> granicus.if.org Git - sudo/commitdiff
Replace use of HAVE_GETCWD with PREFER_PORTABLE_GETCWD.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 28 Jul 2014 22:36:43 +0000 (16:36 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 28 Jul 2014 22:36:43 +0000 (16:36 -0600)
It is safe to assume getcwd() exists, we just need to handle broken ones.

config.h.in
configure
configure.ac
include/sudo_compat.h

index 52ffd8b6cdf39f945e762917706fd6ee03c80157..70e40fd9c147b3fe02eaa525609b9c7dcf9f2522 100644 (file)
    passwords). */
 #undef HAVE_GETAUTHUID
 
-/* Define to 1 if you have the `getcwd' function. */
-#undef HAVE_GETCWD
-
 /* Define to 1 if you have the `getdomainname' function. */
 #undef HAVE_GETDOMAINNAME
 
    ones. */
 #undef PC_INSULTS
 
+/* Enable replacement getcwd if system getcwd is broken. */
+#undef PREFER_PORTABLE_GETCWD
+
 /* Enable replacement (v)snprintf if system (v)snprintf is broken. */
 #undef PREFER_PORTABLE_SNPRINTF
 
index 62716d837203394e1d30c8f657a0de189ef04c8f..e6fd3bf353014c43110628521d38e8e346958f45 100755 (executable)
--- a/configure
+++ b/configure
@@ -14262,19 +14262,13 @@ case "$host" in
                RTLD_PRELOAD_DELIM=" "
 
                # getcwd(3) opens a pipe to getpwd(1)!?!
-               ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd"
-if test "x$ac_cv_func_getcwd" = xyes; then :
-  $as_echo "#define HAVE_GETCWD 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
+               case " $LIBOBJS " in
   *" getcwd.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS getcwd.$ac_objext"
  ;;
 esac
 
-fi
-
+               $as_echo "#define PREFER_PORTABLE_GETCWD 1" >>confdefs.h
 
 
                # system headers lack prototypes but gcc helps...
@@ -25040,5 +25034,6 @@ fi
 
 
 
+
 
 
index 2972c5c3b8d1f01d997d331441386e80643ef745..3d9ffff4c1b072e3ff18f08795ebd7349818427b 100644 (file)
@@ -1637,7 +1637,8 @@ case "$host" in
                RTLD_PRELOAD_DELIM=" "
 
                # getcwd(3) opens a pipe to getpwd(1)!?!
-               AC_REPLACE_FUNCS(getcwd)
+               AC_LIBOBJ(getcwd)
+               AC_DEFINE(PREFER_PORTABLE_GETCWD)
 
                # system headers lack prototypes but gcc helps...
                if test -n "$GCC"; then
@@ -3988,6 +3989,7 @@ AH_TEMPLATE(NO_ROOT_MAILER, [Define to avoid runing the mailer as root.])
 AH_TEMPLATE(NO_ROOT_SUDO, [Define to 1 if root should not be allowed to use sudo.])
 AH_TEMPLATE(NO_TTY_TICKETS, [Define to 1 if you want a single ticket file instead of per-tty files.])
 AH_TEMPLATE(PC_INSULTS, [Define to 1 to replace politically incorrect insults with less offensive ones.])
+AH_TEMPLATE(PREFER_PORTABLE_GETCWD, [Enable replacement getcwd if system getcwd is broken.])
 AH_TEMPLATE(SECURE_PATH, [Define to 1 to override the user's path with a built-in one.])
 AH_TEMPLATE(SEND_MAIL_WHEN_NOT_OK, [Define to 1 to send mail when the user is not allowed to run a command.])
 AH_TEMPLATE(SEND_MAIL_WHEN_NO_HOST, [Define to 1 to send mail when the user is not allowed to run sudo on this host.])
index 2f9638990ef810f9bb6981dccb7c83f30fcd7a83..67812362cfc75bfd8b517e5f5c995f3390ac65c2 100644 (file)
@@ -363,11 +363,11 @@ __dso_public void sudo_closefrom(int);
 # undef closefrom
 # define closefrom(_a) sudo_closefrom((_a))
 #endif /* HAVE_CLOSEFROM */
-#ifndef HAVE_GETCWD
+#ifdef PREFER_PORTABLE_GETCWD
 __dso_public char *sudo_getcwd(char *, size_t size);
 # undef getcwd
 # define getcwd(_a, _b) sudo_getcwd((_a), (_b))
-#endif /* HAVE_GETCWD */
+#endif /* PREFER_PORTABLE_GETCWD */
 #ifndef HAVE_GETGROUPLIST
 __dso_public int sudo_getgrouplist(const char *, gid_t, gid_t *, int *);
 # undef getgrouplist