dtsession: also block HUP and PIPE when preparing to shutdown
[oweals/cde.git] / cde / programs / dtsession / SmUI.c
index 167ea86b296ecdd7109fc8b1e88a894fef6baf3e..ada4756816d5c773fd2def59c46a8705b2a72237 100644 (file)
@@ -1157,6 +1157,8 @@ ImmediateExit(
      */
 #if !defined(SVR4) && !defined(sco)
     old = sigblock(sigmask(SIGTERM));
+    sigblock(sigmask(SIGHUP));
+    sigblock(sigmask(SIGPIPE));
 #else
     old = sighold(SIGTERM);
 #endif
@@ -1208,6 +1210,11 @@ ImmediateExit(
 
        smGD.loggingOut = True;
 
+        /* JET - set this here so we don't exit prematurely (while
+         * handling our own SM exit callback - duh).
+         */
+       smGD.ExitComplete = False;
+
         saveTimeout = False;
        timerId = XtAppAddTimeOut (smGD.appCon, smRes.saveYourselfTimeout, 
                                   SaveTimeout, NULL);
@@ -1221,6 +1228,13 @@ ImmediateExit(
                XtDispatchEvent(&next);
        }
     }
+    
+    /* JET - need this, since dtsession was exiting in the
+     * XtAppNextEvent above (receiving it's own EXIT SM message) This
+     * is checked in SmExit() so exit's will only occur after this
+     * housekeeping has been completed.
+     */
+    smGD.ExitComplete = True; 
 
     if (smXSMP.saveState.shutdownCanceled == False) {
        /* 
@@ -2116,6 +2130,7 @@ PostXSMPFailureDialog (
        Dimension       width, height;
        Position        x, y;
        XEvent          next;
+        int             len;
 
        pch1 = strdup ((char *) GETMESSAGE(40, 1, 
                "A session cannot be started because of the\nfollowing error:"));
@@ -2171,13 +2186,26 @@ PostXSMPFailureDialog (
 
        error_file = XtMalloc(MAXPATHLEN+1);
        strcpy (error_file, "");
-       if (check_errorlog) {
-               char            *home;
 
-               if (home = getenv ("HOME"))
-                       sprintf (error_file, "%s/%s/%s", home, DtPERSONAL_CONFIG_DIRECTORY,
-                                        DtERRORLOG_FILE);
-       }
+        /* JET - VU#497553 */
+       if (check_errorlog) 
+         {
+           char                *home;
+
+           if (home = getenv ("HOME"))
+             {
+               len = strlen(home) +
+                 strlen(DtPERSONAL_CONFIG_DIRECTORY) +
+                 strlen(DtERRORLOG_FILE);
+
+               if (len > MAXPATHLEN)
+                 error_file = XtRealloc(error_file, len + 1);
+
+               sprintf (error_file, "%s/%s/%s", home, 
+                        DtPERSONAL_CONFIG_DIRECTORY,
+                        DtERRORLOG_FILE);
+             }
+         }
 
        pch5 = XtMalloc (strlen (pch1) + strlen (pch2) + strlen (pch3) + strlen (pch4) + 
                                strlen (error_file) + 15);