[Libreoffice-commits] .: sal/osl
Tor Lillqvist
tml at kemper.freedesktop.org
Tue Jan 25 06:35:59 PST 2011
sal/osl/w32/process.cxx | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
New commits:
commit a4cd4ddd631c98800a0900a458dd256b43d449ba
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Tue Jan 25 16:24:07 2011 +0200
Manipulate also the C runtime's environment
Fixes fdo#33355.
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 796f4c4..1749b8e 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -28,6 +28,7 @@
#define UNICODE
#include "system.h"
+#include <string.h>
#ifdef _MSC_VER
#pragma warning(push,1) /* disable warnings within system headers */
#endif
@@ -419,7 +420,15 @@ oslProcessError SAL_CALL osl_setEnvironment(rtl_uString *ustrVar, rtl_uString *u
LPCWSTR lpName = reinterpret_cast<LPCWSTR>(ustrVar->buffer);
LPCWSTR lpValue = reinterpret_cast<LPCWSTR>(ustrValue->buffer);
if (SetEnvironmentVariableW(lpName, lpValue))
+ {
+ wchar_t *buffer = new wchar_t[wcslen(lpName) + 1 + wcslen(lpValue) + 1];
+ wcscpy(buffer, lpName);
+ wcscat(buffer, L"=");
+ wcscat(buffer, lpValue);
+ _wputenv(buffer);
+ delete[] buffer;
return osl_Process_E_None;
+ }
return osl_Process_E_Unknown;
}
@@ -429,7 +438,14 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString *ustrVar)
//process's environment.
LPCWSTR lpName = reinterpret_cast<LPCWSTR>(ustrVar->buffer);
if (SetEnvironmentVariableW(lpName, NULL))
+ {
+ wchar_t *buffer = new wchar_t[wcslen(lpName) + 1 + 1];
+ wcscpy(buffer, lpName);
+ wcscat(buffer, L"=");
+ _wputenv(buffer);
+ delete[] buffer;
return osl_Process_E_None;
+ }
return osl_Process_E_Unknown;
}
More information about the Libreoffice-commits
mailing list