summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-05-11 18:34:38 +0000
committerJim Meyering <jim@meyering.net>2004-05-11 18:34:38 +0000
commit76a6665c13738a3ffd9df920f15b2488128ef6d2 (patch)
tree96a7bfb878bcb740d8ed2c6c4e9b67e729ce9d45
parentea85958d522a7106401d18e5e2facf6501c2b7d6 (diff)
downloadcoreutils-76a6665c13738a3ffd9df920f15b2488128ef6d2.tar.xz
(save_cwd): If opening `.' read-only fails, try write-only.
-rw-r--r--lib/save-cwd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index f97e9c4f0..17d077db8 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -76,6 +76,8 @@ save_cwd (struct saved_cwd *cwd)
#if HAVE_FCHDIR
cwd->desc = open (".", O_RDONLY | O_DIRECTORY);
if (cwd->desc < 0)
+ cwd->desc = open (".", O_WRONLY | O_DIRECTORY);
+ if (cwd->desc < 0)
{
cwd->name = xgetcwd ();
return cwd->name == NULL;