,(void*)zBuf
,(ULONG)nMaxSize - 1
);
+ zBuf[nMaxSize] = _T('\0');
}
else
{
- wxStrncpy(zBuf, zSysname, nMaxSize - 1);
+ wxStrlcpy(zBuf, zSysname, nMaxSize);
}
-
- zBuf[nMaxSize] = _T('\0');
#endif
return *zBuf ? true : false;
#ifdef USE_NET_API
wxGetUserId( zBuf, nMaxSize );
#else
- wxStrncpy(zBuf, _T("Unknown User"), nMaxSize);
+ wxStrlcpy(zBuf, _T("Unknown User"), nMaxSize);
#endif
return true;
}
static bool wxDoSetEnv(const wxString& variable, const char *value)
{
#if defined(HAVE_SETENV)
+ if ( !value )
+ {
+#ifdef HAVE_UNSETENV
+ return unsetenv(variable.mb_str()) == 0;
+#else
+ value = _T(""); // mustn't pass NULL to setenv()
+#endif
+ }
return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0;
#elif defined(HAVE_PUTENV)
wxString s = variable;