bug-gnulib
[Top][All Lists]
Advanced

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

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


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

Jim Meyering wrote:

> 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.

Pushed with typo-fixed (s/try to/work/) log/ChangeLog:

>From 2a073aa43c076d19beeffcca1684d2bcaaba28be 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 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        |    8 ++++++++
 lib/save-cwd.c   |   12 ------------
 modules/save-cwd |    1 +
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2327bfe..31b8074 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 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  <address@hidden>

        openat, save-cwd: avoid xmalloc
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 099ab2e..4801670 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 e8bf8c4..02a0723 100644
--- a/modules/save-cwd
+++ b/modules/save-cwd
@@ -10,6 +10,7 @@ Depends-on:
 chdir-long
 cloexec
 getcwd
+fchdir
 stdbool
 unistd-safer

--
1.7.3.5



reply via email to

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