From 71995ede980910b2abd7b4aa039be294abdc7a97 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sat, 16 Jun 2007 12:30:49 +0000 Subject: [PATCH] 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 --- libcpp/ChangeLog | 5 +++++ libcpp/files.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 205c1dd9db17..7ae04d07866a 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2007-06-16 Vladimir Prus + + * cppfiles.c (open_file): Prevent the call + for stat from overwriting errno. + 2007-06-09 Vladimir Prus * cppfiles.c (open_file): Account for the diff --git a/libcpp/files.c b/libcpp/files.c index b20c38e8d875..dbd25f272031 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) -- 2.47.2