odk/source/unoapploader/unx/unoapploader.c | 6 +++--- sal/osl/unx/nlsupport.c | 22 ++++++++++++++++++++++ sal/osl/unx/process_impl.cxx | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-)
New commits: commit 4e555abf06c9f2571700bbc10c19d7f2076de63b Author: Jim Jagielski <j...@apache.org> AuthorDate: Fri Jan 18 18:50:36 2019 +0000 Commit: Jim Jagielski <j...@apache.org> CommitDate: Fri Jan 18 18:50:36 2019 +0000 more PATH weirdness on macOS diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c index f825885403e4..1fb1540134f3 100644 --- a/odk/source/unoapploader/unx/unoapploader.c +++ b/odk/source/unoapploader/unx/unoapploader.c @@ -206,10 +206,10 @@ int main( int argc, char *argv[] ) strcat( envstr, value ); } putenv( envstr ); - #ifdef MACOSX +#ifdef MACOSX /* https://bz.apache.org/ooo/show_bug.cgi?id=127965 */ value = getenv( "PATH" ); - size = strlen( "PATH" ) + strlen( "=/usr/local/bin" ); + size = strlen( "PATH" ) + strlen( "=/usr/local/bin" ) + 1; if ( value != NULL ) size += strlen( PATHSEPARATOR ) + strlen( value ); envstr = (char*) malloc( size ); @@ -220,7 +220,7 @@ int main( int argc, char *argv[] ) } strcat( envstr, "/usr/local/bin" ); /* We are adding at the end */ putenv( envstr ); - #endif +#endif } else { diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index 0172ac77e3bc..0f3dd7f17747 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -832,6 +832,8 @@ int macosx_getLocale(char *locale, sal_uInt32 bufferLen); void _imp_getProcessLocale( rtl_Locale ** ppLocale ) { static char *locale = NULL; + char *npath, *opath; + int slen; /* basic thread safeness */ // pthread_mutex_lock( &aLocalMutex ); @@ -870,6 +872,26 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) setenv("LC_CTYPE", locale, 1 ); setenv("LANG", locale, 1 ); + /* + * This is a hack. We know that we are setting some envvars here + * and due to https://bz.apache.org/ooo/show_bug.cgi?id=127965 + * we need to update PATH on macOS. Doing it here ensures + * that it's done but it's not the right location to be doing + * this. + */ + opath = getenv ( "PATH" ); + slen = strlen( "/usr/local/bin" ) + 1; + if ( opath != NULL ) + slen += strlen( ":" ) + strlen( opath ); + npath = malloc( slen ); + if ( opath != NULL ) { + strcat( npath, opath ); + strcat( npath, ":" ); + } + strcat( npath, "/usr/local/bin" ); /* We are adding at the end */ + setenv("PATH", npath, 1 ); + free(npath); + #ifdef DEBUG fprintf( stderr, "nlsupport.c: _imp_getProcessLocale() returning %s as current locale.\n", locale ); #endif diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 30712be02a69..4564491c9070 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -385,7 +385,7 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString* pustrEnvVar) rtl_TextEncoding encoding = osl_getThreadTextEncoding(); rtl_String* pstr_env_var = 0; - OSL_PRECOND(pustrEnvVar, "osl_setEnvironment(): Invalid parameter"); + OSL_PRECOND(pustrEnvVar, "osl_clearEnvironment(): Invalid parameter"); rtl_uString2String( &pstr_env_var, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits