Author: jim
Date: Tue Feb 12 15:34:36 2019
New Revision: 1853444
URL: http://svn.apache.org/viewvc?rev=1853444&view=rev
Log:
Only update PATH if /usr/local/bin is missing for macOS
Modified:
openoffice/trunk/main/odk/source/unoapploader/unx/unoapploader.c
openoffice/trunk/main/sal/osl/unx/nlsupport.c
Modified: openoffice/trunk/main/odk/source/unoapploader/unx/unoapploader.c
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/odk/source/unoapploader/unx/unoapploader.c?rev=1853444&r1=1853443&r2=1853444&view=diff
==============================================================================
--- openoffice/trunk/main/odk/source/unoapploader/unx/unoapploader.c (original)
+++ openoffice/trunk/main/odk/source/unoapploader/unx/unoapploader.c Tue Feb 12
15:34:36 2019
@@ -209,17 +209,19 @@ int main( int argc, char *argv[] )
#ifdef MACOSX
/* https://bz.apache.org/ooo/show_bug.cgi?id=127965 */
value = getenv( "PATH" );
- size = strlen( "PATH" ) + strlen( "=/usr/local/bin" ) + 1;
- if ( value != NULL )
- size += strlen( PATHSEPARATOR ) + strlen( value );
- envstr = (char*) malloc( size );
- strcpy( envstr, "PATH=" );
- if ( value != NULL ) {
- strcat( envstr, value);
- strcat( envstr, PATHSEPARATOR);
+ if (!strstr ( value, "/usr/local/bin" )) {
+ size = strlen( "PATH" ) + strlen( "=/usr/local/bin" ) + 1;
+ if ( value != NULL )
+ size += strlen( PATHSEPARATOR ) + strlen( value );
+ envstr = (char*) malloc( size );
+ strcpy( envstr, "PATH=" );
+ if ( value != NULL ) {
+ strcat( envstr, value);
+ strcat( envstr, PATHSEPARATOR);
+ }
+ strcat( envstr, "/usr/local/bin" ); /* We are adding at the end */
+ putenv( envstr );
}
- strcat( envstr, "/usr/local/bin" ); /* We are adding at the end */
- putenv( envstr );
/* https://bz.apache.org/ooo/show_bug.cgi?id=127966 */
value = getenv ( "HOME" );
Modified: openoffice/trunk/main/sal/osl/unx/nlsupport.c
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/osl/unx/nlsupport.c?rev=1853444&r1=1853443&r2=1853444&view=diff
==============================================================================
--- openoffice/trunk/main/sal/osl/unx/nlsupport.c (original)
+++ openoffice/trunk/main/sal/osl/unx/nlsupport.c Tue Feb 12 15:34:36 2019
@@ -876,22 +876,24 @@ void _imp_getProcessLocale( rtl_Locale *
* 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
+ * that it's done but it's not the perfect location to be doing
* this.
*/
opath = getenv ( "PATH" );
- slen = strlen( "/usr/local/bin" ) + 1;
- if ( opath != NULL )
- slen += strlen( ":" ) + strlen( opath );
- npath = malloc( slen );
- *npath = '\0';
- if ( opath != NULL ) {
- strcat( npath, opath );
- strcat( npath, ":" );
+ if (!strstr ( opath, "/usr/local/bin" )) {
+ slen = strlen( "/usr/local/bin" ) + 1;
+ if ( opath != NULL )
+ slen += strlen( ":" ) + strlen( opath );
+ npath = malloc( slen );
+ *npath = '\0';
+ 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);
}
- 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 );