save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module
authorJim Meyering <meyering@redhat.com>
Tue, 11 Jan 2011 20:41:41 +0000 (21:41 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 11 Jan 2011 21:12:52 +0000 (22:12 +0100)
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.

ChangeLog
lib/save-cwd.c
modules/save-cwd

index 2327bfe..31b8074 100644 (file)
--- 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
index 099ab2e..4801670 100644 (file)
 # 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
index e8bf8c4..02a0723 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 chdir-long
 cloexec
 getcwd
+fchdir
 stdbool
 unistd-safer