diff -ru builtins/common.c builtins/common.c --- builtins/common.c Wed Dec 19 10:30:07 2007 +++ builtins/common.c Wed Dec 19 10:34:58 2007 @@ -479,11 +479,8 @@ if (the_current_working_directory == 0) { -#if defined (GETCWD_BROKEN) - the_current_working_directory = getcwd (0, PATH_MAX); -#else - the_current_working_directory = getcwd (0, 0); -#endif + char *t = xmalloc(PATH_MAX); + the_current_working_directory = getcwd (t, PATH_MAX); if (the_current_working_directory == 0) { fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"), diff -ru config-bot.h config-bot.h --- config-bot.h Wed Dec 19 10:30:06 2007 +++ config-bot.h Wed Dec 19 10:31:16 2007 @@ -70,14 +70,6 @@ # define TERMIOS_MISSING #endif -/* If we have a getcwd(3), but one that does not dynamically allocate memory, - #undef HAVE_GETCWD so the replacement in getcwd.c will be built. We do - not do this on Solaris, because their implementation of loopback mounts - breaks the traditional file system assumptions that getcwd uses. */ -#if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN) && !defined (SOLARIS) -# undef HAVE_GETCWD -#endif - #if !defined (HAVE_DEV_FD) && defined (NAMED_PIPES_MISSING) # undef PROCESS_SUBSTITUTION #endif diff -ru configure.in configure.in --- configure.in Wed Dec 19 10:30:09 2007 +++ configure.in Wed Dec 19 10:37:08 2007 @@ -894,9 +894,6 @@ BASH_FUNC_OPENDIR_CHECK BASH_FUNC_ULIMIT_MAXFDS BASH_FUNC_GETENV -if test "$ac_cv_func_getcwd" = "yes"; then -BASH_FUNC_GETCWD -fi BASH_FUNC_POSIX_SETJMP BASH_FUNC_STRCOLL diff -ru aclocal.m4 aclocal.m4 --- aclocal.m4 Tue Sep 12 23:18:07 2006 +++ aclocal.m4 Wed Dec 19 10:37:33 2007 @@ -684,32 +684,6 @@ fi ]) -AC_DEFUN(BASH_FUNC_GETCWD, -[AC_MSG_CHECKING([if getcwd() will dynamically allocate memory]) -AC_CACHE_VAL(bash_cv_getcwd_malloc, -[AC_TRY_RUN([ -#include -#ifdef HAVE_UNISTD_H -#include -#endif - -main() -{ - char *xpwd; - xpwd = getcwd(0, 0); - exit (xpwd == 0); -} -], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no, - [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no) - bash_cv_getcwd_malloc=no] -)]) -AC_MSG_RESULT($bash_cv_getcwd_malloc) -if test $bash_cv_getcwd_malloc = no; then -AC_DEFINE(GETCWD_BROKEN) -AC_LIBOBJ(getcwd) -fi -]) - dnl dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every dnl system, we can't use AC_PREREQ