History

fix #include_next infinite loop bug, see http://savannah.nongnu.org/bugs/?31357

Sergey Vinokurov committed 14 years ago

Commit 3d409b01 parent ca387921 file · +27 −0Browse files

Unified · Split

libtcc.c+27−0
@@ -34,6 +34,10 @@ ST_DATA struct TCCState *tcc_state; · 33 unmodified lines
3434
3535 /********************************************************/
3636
37+#ifndef _WIN32
38+#include <limits.h>
39+#endif
40+
3741 #ifdef ONE_SOURCE
3842 #include "tccpp.c"
3943 #include "tccgen.c"
@@ -318,7 +322,30 @@ static void tcc_split_path(TCCState *s, void ***p_ary, int *p_nb_ary, const char · 278 unmodified lines
318322 }
319323 }
320324 cstr_ccat(&str, '\0');
325+#ifndef _WIN32
326+ {
327+ int i, do_include;
328+ char tmp[PATH_MAX];
329+
330+ if (realpath(str.data, tmp)) {
331+ str.size = 0;
332+ cstr_cat(&str, tmp);
333+ cstr_ccat(&str, '\0');
334+ }
335+
336+ do_include = 1;
337+ for (i = 0; i < *p_nb_ary && do_include; i++) {
338+ do_include = do_include &&
339+ strcmp((char*)str.data, (char*)(*p_ary)[i]);
340+ }
341+
342+ if (do_include) {
343+ dynarray_add(p_ary, p_nb_ary, str.data);
344+ }
345+ }
346+#else
321347 dynarray_add(p_ary, p_nb_ary, str.data);
348+#endif
322349 in = p+1;
323350 } while (*p);
324351 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t