From 2156546df22da60d1dfc49c76a638859d86a792d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 5 Dec 2006 13:20:38 +0000 Subject: * path.cc (cwdstuff::set): Don't try to open directory on systems not supporting that. --- winsup/cygwin/path.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/path.cc') 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 */ -- cgit v1.2.3