summaryrefslogtreecommitdiff
path: root/sal/osl/unx/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/unx/signal.c')
-rw-r--r--sal/osl/unx/signal.c91
1 files changed, 42 insertions, 49 deletions
diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c
index c5141fa02260..5563375d9567 100644
--- a/sal/osl/unx/signal.c
+++ b/sal/osl/unx/signal.c
@@ -74,10 +74,14 @@
#include "file_path_helper.h"
#define ACT_IGNORE 1
-#define ACT_ABORT 2
-#define ACT_EXIT 3
-#define ACT_SYSTEM 4
-#define ACT_HIDE 5
+#define ACT_EXIT 2
+#define ACT_SYSTEM 3
+#define ACT_HIDE 4
+#ifdef SAL_ENABLE_CRASH_REPORT
+# define ACT_ABORT 5
+#else
+# define ACT_ABORT ACT_SYSTEM
+#endif
#define MAX_PATH_LEN 2048
@@ -556,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;
@@ -728,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 );