bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module


From: Jim Meyering
Subject: [PATCH] save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module
Date: Tue, 11 Jan 2011 21:46:13 +0100

Looking at save-cwd, I noticed it contained
the last test in gnulib of HAVE_FCHDIR.
No longer needed:

Incidentally, openat already depended on fchdir, so at least
from openat's perspective, making save-cwd depend on fchdir
does not expand the set of required modules.

>From 72b237cf5ad9a8660ed14440f9b10bce6365f5dd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 11 Jan 2011 21:41:41 +0100
Subject: [PATCH] save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module

There is no need to try to 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        |    8 ++++++++
 lib/save-cwd.c   |   12 ------------
 modules/save-cwd |    1 +
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f8cd305..94eb980 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-11  Jim Meyering  <address@hidden>
+
+       save-cwd: remove #if-!HAVE_FCHDIR'd code; use the fchdir module
+       There is no need to try to 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  <address@hidden>

        openat: Increase OPENAT_BUFFER_SIZE from 512 to at least 1024
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index be35192..c546f23 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 aab5e5e..25f5cad 100644
--- a/modules/save-cwd
+++ b/modules/save-cwd
@@ -9,6 +9,7 @@ m4/save-cwd.m4
 Depends-on:
 chdir-long
 cloexec
+fchdir
 stdbool
 unistd-safer
 xgetcwd
--
1.7.3.5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]