summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-03-09 23:21:00 +0000
committerJim Meyering <jim@meyering.net>2005-03-09 23:21:00 +0000
commit9d0f3eeb6cbf162173ec7341a2ed24e75e39b5fa (patch)
treee56d3778740fc715126d4a23cb8f83f53ba4f353
parent5ccd8ce31dfcb9b2405447618167fffae691b492 (diff)
downloadcoreutils-9d0f3eeb6cbf162173ec7341a2ed24e75e39b5fa.tar.xz
[!HAVE_FCHDIR]: Define open, fchdir, and chdir_long
so that this module works on systems without fchdir.
-rw-r--r--lib/save-cwd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 596b78c8d..fe4bb970c 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -44,6 +44,18 @@
#include "chdir-long.h"
#include "xgetcwd.h"
+/* 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