From 31d481aa201d7181e9375dba7b00065114c66796 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 12 Mar 2010 15:06:21 +0100 Subject: [PATCH] sb121: #i86044# call crash_report with full path (and make some simplifications) --- sal/osl/unx/signal.c | 79 +++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 45 deletions(-) diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c index 14cb19a65f82..5563375d9567 100644 --- a/sal/osl/unx/signal.c +++ b/sal/osl/unx/signal.c @@ -560,7 +560,7 @@ static int ReportCrash( int Signal ) if (Signals[i].Signal == Signal && Signals[i].Action == ACT_ABORT ) { int ret; - char szShellCmd[512]; + char szShellCmd[512] = { '\0' }; char *pXMLTempName = NULL; char *pStackTempName = NULL; char *pChecksumTempName = NULL; @@ -732,68 +732,57 @@ static int ReportCrash( int Signal ) if ( checksumout ) fclose( checksumout ); -#if defined( LINUX ) - if ( pXMLTempName && pChecksumTempName && pStackTempName ) - snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "crash_report -p %d -s %d -xml %s -chksum %s -stack %s%s", - getpid(), - Signal, - pXMLTempName, - pChecksumTempName, - pStackTempName, - bAutoCrashReport ? " -noui -send" : " -noui" ); -#elif defined( MACOSX ) if ( pXMLTempName && pChecksumTempName && pStackTempName ) +#endif /* INCLUDE_BACKTRACE */ { - rtl_uString *crashrep_url = NULL; - rtl_uString *crashrep_path = NULL; - rtl_String *crashrep_path_system = NULL; - - rtl_string2UString( &crashrep_url, RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program/crash_report.bin"), OSTRING_TO_OUSTRING_CVTFLAGS ); - rtl_bootstrap_expandMacros( &crashrep_url ); - osl_getSystemPathFromFileURL( crashrep_url, &crashrep_path ); + rtl_uString * crashrep_url = NULL; + rtl_uString * crashrep_path = NULL; + rtl_String * crashrep_path_system = NULL; + rtl_string2UString( + &crashrep_url, + RTL_CONSTASCII_USTRINGPARAM( + "$BRAND_BASE_DIR/program/crashrep"), + OSTRING_TO_OUSTRING_CVTFLAGS); + rtl_bootstrap_expandMacros(&crashrep_url); + osl_getSystemPathFromFileURL(crashrep_url, &crashrep_path); rtl_uString2String( &crashrep_path_system, - rtl_uString_getStr( crashrep_path ), - rtl_uString_getLength( crashrep_path ), + rtl_uString_getStr(crashrep_path), + rtl_uString_getLength(crashrep_path), osl_getThreadTextEncoding(), - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR ); - - rtl_uString_release( crashrep_url ); - rtl_uString_release( crashrep_path ); - + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR + | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)); + rtl_uString_release(crashrep_url); + rtl_uString_release(crashrep_path); +#if defined INCLUDE_BACKTRACE && (defined LINUX || defined MACOSX) snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "%s -p %d -s %d -xml %s -chksum %s -stack %s%s", - rtl_string_getStr( crashrep_path_system ), + "%s -p %d -s %d -xml %s -chksum %s -stack %s -noui%s", + rtl_string_getStr(crashrep_path_system), getpid(), Signal, pXMLTempName, pChecksumTempName, pStackTempName, - bAutoCrashReport ? " -noui -send" : " -noui" ); - - rtl_string_release( crashrep_path_system ); - - printf( "%s\n", szShellCmd ); - } -#elif defined ( SOLARIS ) - if ( pXMLTempName && pChecksumTempName ) + bAutoCrashReport ? " -send" : "" ); +#elif defined INCLUDE_BACKTRACE && defined SOLARIS snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "crash_report -p %d -s %d -xml %s -chksum %s%s", + "%s -p %d -s %d -xml %s -chksum %s -noui%s", + rtl_string_getStr(crashrep_path_system), getpid(), Signal, pXMLTempName, pChecksumTempName, - bAutoCrashReport ? " -noui -send" : " -noui" ); + bAutoCrashReport ? " -send" : "" ); +#else + snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), + "%s -p %d -s %d -noui%s", + rtl_string_getStr(crashrep_path_system), + getpid(), Signal, bAutoCrashReport ? " -send" : "" ); #endif + rtl_string_release(crashrep_path_system); + } -#else /* defined INCLUDE BACKTRACE */ - snprintf( szShellCmd, sizeof(szShellCmd)/sizeof(szShellCmd[0]), - "crash_report -p %d -s %d%s", getpid(), Signal, bAutoCrashReport ? " -noui -send" : " -noui" ); -#endif /* defined INCLUDE BACKTRACE */ - - - ret = system( szShellCmd ); + ret = szShellCmd[0] == '\0' ? -1 : system( szShellCmd ); if ( pXMLTempName ) unlink( pXMLTempName );