summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-10-18 15:43:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2010-10-18 15:43:44 +0100
commitb725a3ec577ba2943b8e9d5f256c0104b60db476 (patch)
treeef6e8776d275164d0199d5eaade9ff7074fc96e2 /tools
parent53b8a31c87bb67ca0d49391ca9e2a324cecf3f39 (diff)
#i112656# add osl_setEnvironment and osl_clearEnvironment
Diffstat (limited to 'tools')
-rw-r--r--tools/source/misc/extendapplicationenvironment.cxx19
1 files changed, 4 insertions, 15 deletions
diff --git a/tools/source/misc/extendapplicationenvironment.cxx b/tools/source/misc/extendapplicationenvironment.cxx
index 3e3eb48416a4..1502158c09b0 100644
--- a/tools/source/misc/extendapplicationenvironment.cxx
+++ b/tools/source/misc/extendapplicationenvironment.cxx
@@ -30,8 +30,6 @@
#include "sal/config.h"
#include <stdlib.h>
- // not <cstdlib> as putenv is POSIX-only; setenv instead of putenv would be
- // better but is not supported by Solaris 9 and earlier
#if defined UNX
#include <sys/resource.h>
@@ -64,10 +62,9 @@ void extendApplicationEnvironment() {
// Make sure URE_BOOTSTRAP environment variable is set (failure is fatal):
rtl::OUStringBuffer env;
- env.appendAscii(RTL_CONSTASCII_STRINGPARAM("URE_BOOTSTRAP="));
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("URE_BOOTSTRAP"));
rtl::OUString uri;
- if (rtl::Bootstrap::get(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_BOOTSTRAP")), uri))
+ if (rtl::Bootstrap::get(envVar, uri))
{
if (!uri.matchIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.pathname:")))
@@ -87,16 +84,8 @@ void extendApplicationEnvironment() {
env.appendAscii(
RTL_CONSTASCII_STRINGPARAM(SAL_CONFIGFILE("fundamental")));
}
- rtl::OString s;
- if (!env.makeStringAndClear().convertToString(
- &s, osl_getThreadTextEncoding(),
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
- | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
- {
- abort();
- }
- rtl_string_acquire(s.pData); // argument to putenv must leak
- if (putenv(const_cast< char * >(s.getStr())) != 0) {
+ rtl::OUString envValue(env.makeStringAndClear());
+ if (osl_setEnvironment(envVar.pData, envValue.pData) != osl_Process_E_None) {
abort();
}
}