cpp: search local dir only for quoted headers
authorMichael Wallner <mike@php.net>
Wed, 18 Apr 2018 11:47:32 +0000 (13:47 +0200)
committerMichael Wallner <mike@php.net>
Wed, 18 Apr 2018 11:47:32 +0000 (13:47 +0200)
src/cpp.c

index 5ab6492..908c21f 100644 (file)
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -469,7 +469,7 @@ bool psi_cpp_include(struct psi_cpp *cpp, const struct psi_token *file, unsigned
        bool parsed = false;
        int f_len = strlen(file->text);
 
-       if (!(flags & PSI_CPP_INCLUDE_NEXT) || *file->text == '/') {
+       if (file->type == PSI_T_QUOTED_STRING && (!(flags & PSI_CPP_INCLUDE_NEXT) || *file->text == '/')) {
                /* first try as is, full or relative path */
                char temp[PATH_MAX], *path = temp;
 
@@ -499,7 +499,7 @@ bool psi_cpp_include(struct psi_cpp *cpp, const struct psi_token *file, unsigned
                        }
                }
 
-               if (!(flags & PSI_CPP_INCLUDE_NEXT) || !cpp->search) {
+               if (!(flags & PSI_CPP_INCLUDE_NEXT)) {
                        cpp->search = PSI_G(search_path);
                }