summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-04-14 18:17:00 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-04-17 16:13:56 +0100
commitfa15135c278e7f371c7bc22bc85e53198b521ca9 (patch)
tree7fa0b615a61d14d82efb699a969d0384c2235aac /desktop
parent67b4c0b556c2bc586d0a2d63d0fd6efa32a6c25c (diff)
oosplash: handle SIGTERM by killing soffice.bin
Conflicts: desktop/unx/source/start.c Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'desktop')
-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 6152e4cd8d98..6d1decc578af 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -786,6 +786,19 @@ exec_javaldx (Args *args)
osl_closeFile(fileOut);
}
+// 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;
@@ -798,6 +811,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] );
@@ -870,6 +884,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;
@@ -895,6 +910,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