diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-12-05 13:20:38 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-12-05 13:20:38 +0000 |
commit | 2156546df22da60d1dfc49c76a638859d86a792d (patch) | |
tree | 0d02506a743e26d543e331669914576ae6f352a3 /winsup/cygwin/path.cc | |
parent | a83c59fbc35c3083da812963e1bff3e9b1b657ac (diff) | |
download | cygnal-2156546df22da60d1dfc49c76a638859d86a792d.tar.gz cygnal-2156546df22da60d1dfc49c76a638859d86a792d.tar.bz2 cygnal-2156546df22da60d1dfc49c76a638859d86a792d.zip |
* path.cc (cwdstuff::set): Don't try to open directory on systems not
supporting that.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 3012e2564..9d1cb730e 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -4214,15 +4214,18 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit) set_errno (ENOTDIR); goto out; } - HANDLE h = CreateFile (win32_cwd, GENERIC_READ, wincap.shared (), - NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (h == INVALID_HANDLE_VALUE) + if (wincap.can_open_directories ()) { - __seterrno (); - goto out; + HANDLE h = CreateFile (win32_cwd, GENERIC_READ, wincap.shared (), + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (h == INVALID_HANDLE_VALUE) + { + __seterrno (); + goto out; + } + CloseHandle (h); } - CloseHandle (h); } } /* If there is no win32 path or it has the form c:xxx, get the value */ |