summaryrefslogtreecommitdiff
path: root/desktop/unx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-04-14 18:17:00 +0200
committerMichael Stahl <mstahl@redhat.com>2012-04-14 21:07:15 +0200
commit946e7180be96178937e7be1b0bd7132902709a87 (patch)
treec14e84026e40859e0decd79b9e3166791612fa14 /desktop/unx
parent228515e7783aecdb992258765554a530d6c831f3 (diff)
oosplash: handle SIGTERM by killing soffice.bin
Diffstat (limited to 'desktop/unx')
-rw-r--r--desktop/unx/source/start.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index 410c2fd7700f..307cd881b182 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -765,6 +765,19 @@ exec_javaldx (Args *args)
#endif
+// has to be a global :(
+oslProcess * g_pProcess = 0;
+
+void sigterm_handler(int ignored)
+{
+ (void) ignored;
+ if (g_pProcess)
+ {
+ // forward signal to soffice.bin
+ osl_terminateProcess(g_pProcess);
+ }
+}
+
SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{
int fd = 0;
@@ -777,6 +790,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
/* turn SIGPIPE into an error */
signal( SIGPIPE, SIG_IGN );
+ signal( SIGTERM, &sigterm_handler );
args = args_parse ();
args->pAppPath = get_app_path( argv[0] );
@@ -849,6 +863,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
/* Periodically update the splash & the percent according
to what status_fd says, poll quickly only while starting */
info = child_spawn (args, bAllArgs, bShortWait);
+ g_pProcess = info->child;
while (!child_exited_wait (info, bShortWait))
{
ProgressStatus eResult;
@@ -874,6 +889,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
#endif
status = child_get_exit_code(info);
+ g_pProcess = 0; // reset
switch (status) {
case 79: // re-start with just -env: parameters
#if OSL_DEBUG_LEVEL > 0