* path.cc (cwdstuff::set): Don't try to open directory on systems not

supporting that.
This commit is contained in:
Corinna Vinschen 2006-12-05 13:20:38 +00:00
parent a83c59fbc3
commit 2156546df2
2 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2006-12-05 Corinna Vinschen <corinna@vinschen.de>
* path.cc (cwdstuff::set): Don't try to open directory on systems not
supporting that.
2006-12-05 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (get_cygwin_startup_info): Fix comment.

View File

@ -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 */