It is safe to assume getcwd() exists, we just need to handle broken ones.
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
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...
+
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
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.])
# 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