changeset 14168:07d9a8f73881

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.
author Jim Meyering <meyering@redhat.com>
date Tue, 11 Jan 2011 21:41:41 +0100
parents 7e8e0e534d32
children d5718604e475
files ChangeLog lib/save-cwd.c modules/save-cwd
diffstat 3 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-11  Jim Meyering  <meyering@redhat.com>
+
+	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  <eggert@cs.ucla.edu>
 
 	openat, save-cwd: avoid xmalloc
--- 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
--- a/modules/save-cwd
+++ b/modules/save-cwd
@@ -10,6 +10,7 @@
 chdir-long
 cloexec
 getcwd
+fchdir
 stdbool
 unistd-safer