Skip to content

Commit 5ccd51f

Browse files
committed
mingw: HOT FIX: work around environment issues -- again
This developer should really, really have known better. The fact that we are changing the environment in ways for which the MSVCRT is not prepared for is bad enough. But then this developer followed the request to re-enable nedmalloc -- despite the prediction that it would cause an access violation, predicting it in the same message as the request to re-enable nedmalloc, no less! To paper over the issue until the time when this developer finds the time to re-design the Unicode environment handling from scratch, let's hope that cURL is the only library we are using that *may* set an environment variable using MSVCRT's putenv() after we fscked the environment up. Note: this commit can serve as no source of pride to anyone, certainly not yours truly. It is necessary as a quick and pragmatic stop gap, though, to prevent worse problems. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5790019 commit 5ccd51f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compat/mingw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,13 @@ void mingw_startup()
23282328
if (!getenv("TERM"))
23292329
setenv("TERM", "cygwin", 1);
23302330

2331+
/*
2332+
* Avoid a segmentation fault when cURL tries to set the CHARSET
2333+
* variable and putenv() barfs at our nedmalloc'ed environment.
2334+
*/
2335+
if (!getenv("CHARSET"))
2336+
setenv("CHARSET", "cp1252", 1);
2337+
23312338
/* initialize critical section for waitpid pinfo_t list */
23322339
InitializeCriticalSection(&pinfo_cs);
23332340

0 commit comments

Comments
 (0)