# HG changeset patch # User Jim Meyering # Date 1294778501 -3600 # Node ID 07d9a8f738815e5aa81883d7da567922e1d73add # Parent 7e8e0e534d32919bcc5376c64eea15025f2679eb save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module There is no need to work around the lack of the fchdir function, since gnulib can now provide a replacement when required. * lib/save-cwd.c: Remove #if !HAVE_FCHDIR...#endif code. * modules/save-cwd (Depends-on): Add fchdir. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-01-11 Jim Meyering + + save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module + There is no need to work around the lack of the fchdir function, + since gnulib can now provide a replacement when required. + * lib/save-cwd.c: Remove #if !HAVE_FCHDIR...#endif code. + * modules/save-cwd (Depends-on): Add fchdir. + 2011-01-11 Paul Eggert openat, save-cwd: avoid xmalloc diff --git a/lib/save-cwd.c b/lib/save-cwd.c --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -39,18 +39,6 @@ # define GNULIB_FCNTL_SAFER 0 #endif -/* On systems without the fchdir function (WOE), pretend that open - always returns -1 so that save_cwd resorts to using xgetcwd. - Since chdir_long requires fchdir, use chdir instead. */ -#if !HAVE_FCHDIR -# undef open -# define open(File, Flags) (-1) -# undef fchdir -# define fchdir(Fd) (abort (), -1) -# undef chdir_long -# define chdir_long(Dir) chdir (Dir) -#endif - /* Record the location of the current working directory in CWD so that the program may change to other directories and later use restore_cwd to return to the recorded location. This function may allocate diff --git a/modules/save-cwd b/modules/save-cwd --- a/modules/save-cwd +++ b/modules/save-cwd @@ -10,6 +10,7 @@ chdir-long cloexec getcwd +fchdir stdbool unistd-safer