X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0472c7c9e1e9984f7d48eef7857e631c3adbd0d..57f2a6529245d54274a4c56469f1828a6f8fd497:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 784cf1031f..429cf3e2f3 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -1098,6 +1098,18 @@ bool wxGetEnv(const wxString& var, wxString *value) static bool wxDoSetEnv(const wxString& variable, const char *value) { #if defined(HAVE_SETENV) + if ( !value ) + { +#ifdef HAVE_UNSETENV + // don't test unsetenv() return value: it's void on some systems (at + // least Darwin) + unsetenv(variable.mb_str()); + return true; +#else + value = ""; // we can't pass NULL to setenv() +#endif + } + return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0; #elif defined(HAVE_PUTENV) wxString s = variable;