[Libreoffice-commits] .: desktop/unx

Michael Stahl mst at kemper.freedesktop.org
Thu Apr 19 06:08:42 PDT 2012


 desktop/unx/source/start.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit f92d22565d4d389b0c93d45a1995521431585694
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 19 15:00:18 2012 +0200

    oosplash: improve signal handlers:
    
    - global variable should be volatile
    - signal is deprecated, use sigaction instead
    - exit from the handler

diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index 307cd88..d1a09a7 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] );


More information about the Libreoffice-commits mailing list