mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-11 20:50:29 +08:00
cppfiles.c (open_file): Account for the fact that on windows, opening a directory gives EACCES.
* cppfiles.c (open_file): Account for the fact that on windows, opening a directory gives EACCES. From-SVN: r125590
This commit is contained in:
parent
ad365750b1
commit
84152c25a5
@ -1,3 +1,9 @@
|
||||
2007-06-09 Vladimir Prus <vladimir@codesourcery.com>
|
||||
|
||||
* cppfiles.c (open_file): Account for the
|
||||
fact that on windows, opening a directory gives
|
||||
EACCES.
|
||||
|
||||
2007-06-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
PR preprocessor/23479
|
||||
|
@ -228,6 +228,19 @@ open_file (_cpp_file *file)
|
||||
close (file->fd);
|
||||
file->fd = -1;
|
||||
}
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
else if (errno == EACCES)
|
||||
{
|
||||
/* On most UNIX systems, open succeeds on a directory. Above,
|
||||
we check if we have opened a directory and if so, set errno
|
||||
to ENOENT. However, on Windows, opening a directory
|
||||
fails with EACCESS. We want to return ENOENT in that
|
||||
case too. */
|
||||
if (stat (file->path, &file->st) == 0
|
||||
&& S_ISDIR (file->st.st_mode))
|
||||
errno = ENOENT;
|
||||
}
|
||||
#endif
|
||||
else if (errno == ENOTDIR)
|
||||
errno = ENOENT;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user