bug-gnulib
[Top][All Lists]
Advanced

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

[bug-gnulib] RE: GNULib save-cwd.c on Windows & Visual Studio 6.0


From: Conrad T. Pino
Subject: [bug-gnulib] RE: GNULib save-cwd.c on Windows & Visual Studio 6.0
Date: Wed, 9 Mar 2005 06:56:43 -0800

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jim,

> From: Jim Meyering [mailto:address@hidden
> 
> 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).

The patch as submitted does not compile.  This line fails:

    return fchdir (cwd->desc);

The patch at message end does compile and the build completes.

Conrad

Index: save-cwd.c
===================================================================
RCS file: /cvs/ccvs/lib/save-cwd.c,v
retrieving revision 1.6
diff -u -p -r1.6 save-cwd.c
- --- save-cwd.c  1 Mar 2005 18:15:42 -0000       1.6
+++ save-cwd.c  9 Mar 2005 14:50:43 -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.  */
+#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

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4

iQA/AwUBQi8OqrNM28ubzTo9EQKCQACglWgegbLzUqZdLaxd+HC+ls9Jv7oAn1J5
0z2tXUL54UlQZECFNzsG4PuC
=7E/O
-----END PGP SIGNATURE-----





reply via email to

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