From: Jim Meyering Date: Tue, 11 Jan 2011 20:41:41 +0000 (+0100) Subject: save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module X-Git-Tag: v0.1~3352 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=2a073aa43c076d19beeffcca1684d2bcaaba28be;p=gnulib.git 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 index 2327bfe57..31b8074ff 100644 --- 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 index 099ab2ea7..48016704a 100644 --- 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 index e8bf8c4ee..02a072339 100644 --- a/modules/save-cwd +++ b/modules/save-cwd @@ -10,6 +10,7 @@ Depends-on: chdir-long cloexec getcwd +fchdir stdbool unistd-safer