aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccrun.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tccrun.c b/tccrun.c
index 8f7257d..8e53a70 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -127,6 +127,7 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
for (i=0; i<argc; ++i)
bound_new_region(argv[i], strlen(argv[i]));
+ errno = 0; /* clean errno value */
ret = (*prog_main)(argc, argv);
/* unmark argv area */
@@ -137,7 +138,10 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
bound_exit();
} else
#endif
+ {
+ errno = 0; /* clean errno value */
ret = (*prog_main)(argc, argv);
+ }
return ret;
}