diff options
author | vprus <vprus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-09 10:16:52 +0000 |
---|---|---|
committer | vprus <vprus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-09 10:16:52 +0000 |
commit | be21d64ca8f36ca14adc881d88212e639d26a3b1 (patch) | |
tree | c8c465740f40eb2c178e1a3ebfe854771da47698 /libcpp/files.c | |
parent | 290262ef2a09796ceec4410fd37ac2b242ca1883 (diff) | |
download | ppe42-gcc-be21d64ca8f36ca14adc881d88212e639d26a3b1.tar.gz ppe42-gcc-be21d64ca8f36ca14adc881d88212e639d26a3b1.zip |
* cppfiles.c (open_file): Account for the
fact that on windows, opening a directory gives
EACCES.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/files.c')
-rw-r--r-- | libcpp/files.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libcpp/files.c b/libcpp/files.c index 3751184d02f..b20c38e8d87 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -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; |