Skip to content

Commit 3871ed5

Browse files
committed
Error out when mingw_startup() *and* NO_UNSETENV are active
The unsetenv code has no idea to update our environ_size, therefore causing segmentation faults when environment variables are removed without compat/mingw.c's knowing (MinGW's optimized lookup would try to strcmp() against NULL in such a case). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cddb6b7 commit 3871ed5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compat/mingw.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ char *mingw_mktemp(char *template);
218218
char *mingw_getcwd(char *pointer, int len);
219219
#define getcwd mingw_getcwd
220220

221+
#ifdef NO_UNSETENV
222+
#error "NO_UNSETENV is incompatible with the MinGW startup code!"
223+
#endif
224+
221225
char *mingw_getenv(const char *name);
222226
#define getenv mingw_getenv
223227
int mingw_putenv(const char *namevalue);

0 commit comments

Comments
 (0)