[comp.windows.x] twm handles signals incorrectlt +FIX

john@labtam.oz (John Carey) (05/08/90)

Sent to mit

			  X Window System Bug Report
			    xbugs@expo.lcs.mit.edu


VERSION:
    R4

CLIENT MACHINE and OPERATING SYSTEM:
    Labtam Delta/386 running System V Release 3.2

DISPLAY TYPE:
    Labtam Xengine (all models)

WINDOW MANAGER:
    twm

AREA:
    twm

SYNOPSIS:
    twm handles signals incorrectly +FIX

DESCRIPTION:
    twm catches SIGQUIT when running in the background.
    The code setting the signals should check if the SIGQUIT is SIG_IGN
    before setting the new handler.

REPEAT BY:
    twm & # start twm in the background
    ^\ # then hit QUIT character
    twm then exits

SAMPLE FIX:
    Here is the patch

--------------------------------------------------------------------------------
*** twm.c_old	Mon May  7 17:05:12 1990
--- twm.c	Mon May  7 17:04:03 1990
***************
*** 179,186 ****
      if (old_handler != SIG_IGN)
  	signal(SIGHUP, Done);
  
!     signal(SIGQUIT, Done);
!     signal(SIGTERM, Done);
  
      Home = getenv("HOME");
      if (Home == NULL)
--- 179,191 ----
      if (old_handler != SIG_IGN)
  	signal(SIGHUP, Done);
  
!     old_handler = signal(SIGQUIT, SIG_IGN);
!     if (old_handler != SIG_IGN)
! 	signal(SIGQUIT, Done);
! 
!     old_handler = signal(SIGTERM, SIG_IGN);
!     if (old_handler != SIG_IGN)
! 	signal(SIGTERM, Done);
  
      Home = getenv("HOME");
      if (Home == NULL)