History

fix a bug #43984: tcc -run reports errno=2

The following program (errno.c) reports errno=2 when run using "tcc -run errno.c" #include <errno.h> #include <stdio.h> int main(void) { printf("errno=%d\n", errno); return 0; }

seyko committed 11 years ago

Commit cde79a81 parent 724425a1 file · +4 −0Browse files

Unified · Split

tccrun.c+4−0
@@ -127,6 +127,7 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 126 unmodified lines
127127 for (i=0; i<argc; ++i)
128128 bound_new_region(argv[i], strlen(argv[i]));
129129
130+ errno = 0; /* clean errno value */
130131 ret = (*prog_main)(argc, argv);
131132
132133 /* unmark argv area */
@@ -137,7 +138,10 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) · 4 unmodified lines
137138 bound_exit();
138139 } else
139140 #endif
141+ {
142+ errno = 0; /* clean errno value */
140143 ret = (*prog_main)(argc, argv);
144+ }
141145 return ret;
142146 }
143147

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