aboutsummaryrefslogtreecommitdiff
path: root/libcpp/files.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2007-06-16 12:30:49 +0000
committerVladimir Prus <vprus@gcc.gnu.org>2007-06-16 12:30:49 +0000
commit71995ede980910b2abd7b4aa039be294abdc7a97 (patch)
tree48d94c15d937cd8daeaa454bfbf4e4619cdad862 /libcpp/files.c
parent6b889d891d24d2edbdb8554d0c1b0c3311799ae3 (diff)
downloadgcc-71995ede980910b2abd7b4aa039be294abdc7a97.zip
gcc-71995ede980910b2abd7b4aa039be294abdc7a97.tar.gz
gcc-71995ede980910b2abd7b4aa039be294abdc7a97.tar.bz2
cppfiles.c (open_file): Prevent the call for stat from overwriting errno.
* cppfiles.c (open_file): Prevent the call for stat from overwriting errno. From-SVN: r125757
Diffstat (limited to 'libcpp/files.c')
-rw-r--r--libcpp/files.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libcpp/files.c b/libcpp/files.c
index b20c38e..dbd25f2 100644
--- a/libcpp/files.c
+++ b/libcpp/files.c
@@ -239,6 +239,9 @@ open_file (_cpp_file *file)
if (stat (file->path, &file->st) == 0
&& S_ISDIR (file->st.st_mode))
errno = ENOENT;
+ else
+ /* The call to stat may have reset errno. */
+ errno = EACCESS;
}
#endif
else if (errno == ENOTDIR)