aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brooks <dave@bcs.co.nz>2015-12-04 10:06:12 +1300
committerDavid Brooks <dave@bcs.co.nz>2015-12-04 10:06:12 +1300
commit5a59517fefeae37195722219b9fd065420b3c0de (patch)
treefe81be34691a78dede990eb0fed1f3d43d2c7792
parentfc7e44469a6252c59a1919842a553c0c30d2ad87 (diff)
The include file handler wasn't rejecting targets that resolve to directories via links.
-rw-r--r--ApiExtractor/parser/rpp/pp-engine-bits.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/ApiExtractor/parser/rpp/pp-engine-bits.h b/ApiExtractor/parser/rpp/pp-engine-bits.h
index 338831f..9ed4f02 100644
--- a/ApiExtractor/parser/rpp/pp-engine-bits.h
+++ b/ApiExtractor/parser/rpp/pp-engine-bits.h
@@ -212,27 +212,20 @@ inline pp::PP_DIRECTIVE_TYPE pp::find_directive(char const *__directive, std::si
inline bool pp::file_isdir(std::string const &__filename) const
{
struct stat __st;
-#if defined(PP_OS_WIN)
if (stat(__filename.c_str(), &__st) == 0)
+#if defined(PP_OS_WIN)
return (__st.st_mode & _S_IFDIR) == _S_IFDIR;
- else
- return false;
#else
- if (lstat(__filename.c_str(), &__st) == 0)
return (__st.st_mode & S_IFDIR) == S_IFDIR;
+#endif
else
return false;
-#endif
}
inline bool pp::file_exists(std::string const &__filename) const
{
struct stat __st;
-#if defined(PP_OS_WIN)
return stat(__filename.c_str(), &__st) == 0;
-#else
- return lstat(__filename.c_str(), &__st) == 0;
-#endif
}
inline FILE *pp::find_include_file(std::string const &__input_filename, std::string *__filepath,
@@ -243,7 +236,7 @@ inline FILE *pp::find_include_file(std::string const &__input_filename, std::str
__filepath->assign(__input_filename);
- if (is_absolute(*__filepath))
+ if (is_absolute(*__filepath) && !file_isdir(*__filepath))
return std::fopen(__filepath->c_str(), "r");
if (! env.current_file.empty())