diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-05-06 08:17:53 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-05-06 08:17:53 +0000 |
commit | f0fde4a0ebb6123d1c8c3ec3328ce3f581b7252a (patch) | |
tree | 15cb2ecb91fe536c15bcf76f3d85f6f8540eb459 /crashrep/source/unx | |
parent | cd401a03baae5854a43d4440fbed82abc7067639 (diff) |
INTEGRATION: CWS crashrep8 (1.20.16); FILE MERGED
2005/05/04 10:22:21 hro 1.20.16.1: #121982# Resolve softlinks in paths sent by crash reporting mechanism
Diffstat (limited to 'crashrep/source/unx')
-rwxr-xr-x | crashrep/source/unx/main.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/crashrep/source/unx/main.cxx b/crashrep/source/unx/main.cxx index a3dcf727f9e6..a6fcbe66c763 100755 --- a/crashrep/source/unx/main.cxx +++ b/crashrep/source/unx/main.cxx @@ -2,9 +2,9 @@ * * $RCSfile: main.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: hr $ $Date: 2004-12-20 09:35:15 $ + * last change: $Author: obo $ $Date: 2005-05-06 09:17:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -600,13 +600,21 @@ string crash_get_details( const hash_map< string, string >& rSettings ) // ensure validity of program relative paths static void setup_program_dir( const char* progname ) { - string aDir = progname; - size_t pos = aDir.rfind( '/' ); - // FIXME: search PATH if necessary - assert( pos != string::npos ); - g_strProgramDir = aDir.substr( 0, pos + 1 ); - aDir.erase( pos ); - chdir( aDir.c_str() ); + char szCanonicProgPath[PATH_MAX]; + + + if ( realpath( progname, szCanonicProgPath ) ) + { + string aDir = szCanonicProgPath; + + size_t pos = aDir.rfind( '/' ); + // FIXME: search PATH if necessary + assert( pos != string::npos ); + + g_strProgramDir = aDir.substr( 0, pos + 1 ); + aDir.erase( pos ); + chdir( aDir.c_str() ); + } } //************************************************************************* |