diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-04-19 15:00:18 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-04-19 15:08:12 +0200 |
commit | f92d22565d4d389b0c93d45a1995521431585694 (patch) | |
tree | 5691e114ee92765c8f8aec73c35c8869aa9dfaac /desktop | |
parent | cf557a25da78bbacf435c9aaec53c3de89dae758 (diff) |
oosplash: improve signal handlers:
- global variable should be volatile
- signal is deprecated, use sigaction instead
- exit from the handler
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/unx/source/start.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index 307cd881b182..d1a09a7efd7b 100644 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -766,7 +766,7 @@ exec_javaldx (Args *args) #endif // has to be a global :( -oslProcess * g_pProcess = 0; +oslProcess * volatile g_pProcess = 0; void sigterm_handler(int ignored) { @@ -776,8 +776,10 @@ void sigterm_handler(int ignored) // forward signal to soffice.bin osl_terminateProcess(g_pProcess); } + _exit(255); } + SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) { int fd = 0; @@ -787,10 +789,18 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) Args *args; int status = 0; struct splash* splash = NULL; + struct sigaction sigpipe_action; + struct sigaction sigterm_action; /* turn SIGPIPE into an error */ - signal( SIGPIPE, SIG_IGN ); - signal( SIGTERM, &sigterm_handler ); + memset(&sigpipe_action, 0, sizeof(struct sigaction)); + sigpipe_action.sa_handler = SIG_IGN; + sigemptyset(&sigpipe_action.sa_mask); + sigaction(SIGPIPE, &sigpipe_action, 0); + memset(&sigterm_action, 0, sizeof(struct sigaction)); + sigterm_action.sa_handler = &sigterm_handler; + sigemptyset(&sigterm_action.sa_mask); + sigaction(SIGTERM, &sigterm_action, 0); args = args_parse (); args->pAppPath = get_app_path( argv[0] ); |