X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsave-cwd.c;h=17d077db890d0b766d9d045f74c53d045c94b36d;hb=9b9bfb49af70f53f177c7a6563fa844a4a50c7db;hp=6fb39f0aa0c91e3864951bf7087268766bda81d8;hpb=d01e199f674be88351d5956a13fe6dc406efacb5;p=gnulib.git diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 6fb39f0aa..17d077db8 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -1,5 +1,5 @@ /* save-cwd.c -- Save and restore current working directory. - Copyright (C) 1995, 1997, 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 1998, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,12 @@ save_cwd (struct saved_cwd *cwd) #if HAVE_FCHDIR cwd->desc = open (".", O_RDONLY | O_DIRECTORY); if (cwd->desc < 0) - return 1; + cwd->desc = open (".", O_WRONLY | O_DIRECTORY); + if (cwd->desc < 0) + { + cwd->name = xgetcwd (); + return cwd->name == NULL; + } # if __sun__ || sun /* On SunOS 4 and IRIX 5.3, fchdir returns EINVAL when auditing