X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsave-cwd.c;h=5f8eb7ca53e12b09a50a3f4885d4a6816c2a6f2d;hb=81979bc8e213e442acf9f2bef9f6e227602c5b70;hp=099ab2ea7e9ed6adc6a367b4ac3ed53f5155f617;hpb=2392b18099a64ffb7aa2cf4fa3c81da96d2a5fc1;p=gnulib.git diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 099ab2ea7..5f8eb7ca5 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -30,7 +30,6 @@ #include "chdir-long.h" #include "unistd--.h" -#include "xgetcwd.h" #include "cloexec.h" #if GNULIB_FCNTL_SAFER @@ -39,18 +38,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 @@ -63,7 +50,8 @@ The `raison d'etre' for this interface is that the working directory is sometimes inaccessible, and getcwd is not robust or as efficient. So, we prefer to use the open/fchdir approach, but fall back on - getcwd if necessary. + getcwd if necessary. This module works for most cases with just + the getcwd-lgpl module, but to be truly robust, use the getcwd module. Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin, SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it