[Libreoffice-commits] .: Branch 'libreoffice-4-0' - vcl/aqua

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 29 04:41:41 PST 2013


 vcl/aqua/source/app/salinst.cxx |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 9bf686e160aa19b598bf3cc11bad75b8119de05f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 29 13:28:48 2013 +0100

    Do not call putenv with a temporary string argument
    
    These bad calls to putenv suddenly caused the buildIdFile string (macro-expanded
    from bootstraprc's UserInstallation) in cleanExtensionCache
    (desktop/source/app/app.cxx) to contain nonsense at least in a local
    libreoffice-4-0-0 of mine, as getenv("UserInstallation") started to return some
    non-null pointer pointing to garbage.
    
    Change-Id: Ib93fd4e1caef016bd0e00bf09800b9532824ac4b
    (cherry picked from commit d841273ba54b173020aa8da18ba7841cf950c13c)
    Reviewed-on: https://gerrit.libreoffice.org/1917
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 90a3fa7..0a08788 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -306,7 +306,6 @@ void InitSalMain()
             rtl::OString aResPath( getenv( "STAR_RESOURCEPATH" ) );
             rtl::OString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) );
             rtl::OString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() );
-            rtl::OString aTmpPath;
             // Get absolute path of command's directory
             if ( !aCmdPath.isEmpty() ) {
                 DirEntry aCmdDirEntry( aCmdPath );
@@ -316,32 +315,29 @@ void InitSalMain()
             // Assign to PATH environment variable
             if ( !aCmdPath.isEmpty() )
             {
-                aTmpPath = rtl::OString( "PATH=" );
-                aTmpPath += aCmdPath;
+                rtl::OString aTmpPath( aCmdPath );
                 if ( !aPath.isEmpty() )
                     aTmpPath += rtl::OUStringToOString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
                 aTmpPath += aPath;
-                putenv( (char*)aTmpPath.getStr() );
+                setenv( "PATH", aTmpPath.getStr(), 1 );
             }
             // Assign to STAR_RESOURCEPATH environment variable
             if ( !aCmdPath.isEmpty() )
             {
-                aTmpPath = rtl::OString( "STAR_RESOURCEPATH=" );
-                aTmpPath += aCmdPath;
+                rtl::OString aTmpPath( aCmdPath );
                 if ( !aResPath.isEmpty() )
                     aTmpPath += rtl::OUStringToOString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
                 aTmpPath += aResPath;
-                putenv( (char*)aTmpPath.getStr() );
+                setenv( "STAR_RESOURCEPATH", aTmpPath.getStr(), 1 );
             }
             // Assign to DYLD_LIBRARY_PATH environment variable
             if ( !aCmdPath.isEmpty() )
             {
-                aTmpPath = rtl::OString( "DYLD_LIBRARY_PATH=" );
-                aTmpPath += aCmdPath;
+                rtl::OString aTmpPath( aCmdPath );
                 if ( !aLibPath.isEmpty() )
                     aTmpPath += rtl::OUStringToOString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
                 aTmpPath += aLibPath;
-                putenv( (char*)aTmpPath.getStr() );
+                setenv( "DYLD_LIBRARY_PATH", aTmpPath.getStr(), 1 );
             }
         }
     }


More information about the Libreoffice-commits mailing list