[Top][All Lists]

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

Re: GNULib save-cwd.c on Windows & Visual Studio 6.0

From: Jim Meyering
Subject: Re: GNULib save-cwd.c on Windows & Visual Studio 6.0
Date: Wed, 09 Mar 2005 09:04:48 +0100

Here's a patch that should restore the ability of save-cwd to
work on systems without the fchdir function.

Would you please see if this is sufficient?
If so, I'll check it in to gnulib (with an AC_CHECK_FUNCS(fchdir)
in save-cwd.m4).

Index: save-cwd.c
RCS file: /fetish/cu/lib/save-cwd.c,v
retrieving revision 1.24
diff -u -p -r1.24 save-cwd.c
--- save-cwd.c  20 Jan 2005 22:17:26 -0000      1.24
+++ save-cwd.c  9 Mar 2005 07:49:19 -0000
@@ -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.  */
+# undef open
+# define open(File, Flags) -1
+# undef fchdir
+# define fchdir(Fd) abort ()
+# undef chdir_long
+# define chdir_long(Dir) chdir (Dir)
 /* 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

reply via email to

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