History

Fix environ variable for macos.

herman ten brugge committed 6 years ago

Commit 3c53d541 parent 039e4ec1 file · +7 −2Browse files

Unified · Split

tccrun.c+7−2
@@ -140,6 +140,11 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 139 unmodified lines
140140 #ifdef CONFIG_TCC_BACKTRACE
141141 rt_context *rc = &g_rtctxt;
142142 #endif
143+# if defined(__APPLE__)
144+ char **envp = NULL;
145+#else
146+ char **envp = environ;
147+#endif
143148
144149 s1->runtime_main = s1->nostdlib ? "_start" : "main";
145150 if ((s1->dflag & 16) && !find_c_sym(s1, s1->runtime_main))
@@ -184,12 +189,12 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 38 unmodified lines
184189 fflush(stdout);
185190 fflush(stderr);
186191 /* These aren't C symbols, so don't need leading underscore handling. */
187− run_cdtors(s1, "__init_array_start", "__init_array_end", argc, argv, environ);
192+ run_cdtors(s1, "__init_array_start", "__init_array_end", argc, argv, envp);
188193 #ifdef CONFIG_TCC_BACKTRACE
189194 if (!rc->do_jmp || !(ret = setjmp(rc->jmp_buf)))
190195 #endif
191196 {
192− ret = prog_main(argc, argv, environ);
197+ ret = prog_main(argc, argv, envp);
193198 }
194199 run_cdtors(s1, "__fini_array_start", "__fini_array_end", 0, NULL, NULL);
195200 if ((s1->dflag & 16) && ret)

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