This is a patch for deslogin-1.3. It repairs a problem where
deslogind hangs on SunOS 4.1.3_u1.  This patch is the 1.33 release.

To apply this patch:

   cd deslogin-1.3
   patch -p1 <thisfile

Released by David A. Barrett <barrett@asgard.cs.Colorado.EDU> on 
Wed Apr  5 11:40:13 MDT 1995.

*** deslogin-1.3/deslogin.c	Wed Mar  8 14:41:26 1995
--- deslogin-1.33/deslogin.c	Tue Mar 21 01:36:52 1995
***************
*** 34,36 ****
  static char ident[] = 
! " @(#) deslogin.c   version 1.32 03-Mar-95 Copyright 1995 by Dave Barrett(barrett@asgard.cs.Colorado.EDU)\n";
  static char RCSid[] = 
--- 34,36 ----
  static char ident[] = 
! " @(#) deslogin.c   version 1.33 21-Mar-95 Copyright 1995 by Dave Barrett(barrett@asgard.cs.Colorado.EDU)\n";
  static char RCSid[] = 
***************
*** 275,277 ****
  
!    chp = (char *) posignal(SIGINT, handler);
     if (chp == (char *) -1L) {
--- 275,277 ----
  
!    chp = (char *) posignal(SIGINT, handler, 0);
     if (chp == (char *) -1L) {
*** deslogin-1.3/deslogind.c	Wed Mar  8 14:41:27 1995
--- deslogin-1.33/deslogind.c	Mon Mar 27 14:51:25 1995
***************
*** 69,71 ****
   *    the process and then attach a debugger to it and examine what is going
!  *    on.
   *
--- 69,71 ----
   *    the process and then attach a debugger to it and examine what is going
!  *    on.  21-Mar-95: deleted this.  Now passed as an argument to posignal.
   *
***************
*** 202,204 ****
  static char ident[] = 
! " @(#) deslogind.c  version 1.32 03-Mar-95 Copyright 1995 by Dave Barrett(barrett@asgard.cs.Colorado.EDU)\n";
  static char RCSid[] = 
--- 202,204 ----
  static char ident[] = 
! " @(#) deslogind.c  version 1.33 21-Mar-95 Copyright 1995 by Dave Barrett(barrett@asgard.cs.Colorado.EDU)\n";
  static char RCSid[] = 
***************
*** 583,585 ****
      */
!    chp = (char *) posignal(SIGINT, sigHandler);
     if (chp == (char *) SIG_ERR) {
--- 583,585 ----
      */
!    chp = (char *) posignal(SIGINT, sigHandler, 0);
     if (chp == (char *) SIG_ERR) {
***************
*** 591,593 ****
      */
!    chp = (char *) posignal(SIGTERM, sigHandler); 
     if (chp == (char *) SIG_ERR) {
--- 591,593 ----
      */
!    chp = (char *) posignal(SIGTERM, sigHandler, 0); 
     if (chp == (char *) SIG_ERR) {
***************
*** 599,601 ****
      */
!    chp = (char *) posignal(SIGHUP, sigHandler); 
     if (chp == (char *) SIG_ERR) {
--- 599,601 ----
      */
!    chp = (char *) posignal(SIGHUP, sigHandler, 0); 
     if (chp == (char *) SIG_ERR) {
***************
*** 939,941 ****
      */
!    if (generic) {
        chp = generic;
--- 939,941 ----
      */
!    if (generic && (generic[0] != '\0')) {	/* short-circuit && */
        chp = generic;
***************
*** 1105,1107 ****
      */
!    chp = (char *) posignal(SIGCHLD, sigHandler);
     if (chp == (char *) SIG_ERR) {
--- 1105,1107 ----
      */
!    chp = (char *) posignal(SIGCHLD, sigHandler, SA_NOCLDSTOP);
     if (chp == (char *) SIG_ERR) {
***************
*** 1456,1458 ****
           log(
! 	    "%s: mkCtrlTty(%d) didn't acquire %s as contrlling terminal--%s\n",
  	    progName, sin, sname, ERRMSG);
--- 1456,1458 ----
           log(
! 	    "%s: mkCtrlTty(%d) didn't acquire %s as controlling terminal--%s\n",
  	    progName, sin, sname, ERRMSG);
***************
*** 1585,1588 ****
     }
!    closeLog();
!    
     res  = execve(shell, cargv, cenv);
--- 1585,1598 ----
     }
!    /*
!     * The exec documentation states that all signals are set to SIG_DFL.
!     * But, doesn't specify that SA_NOCLDSTOP is reset.  This ensures that
!     * it is.  The only system that requires this call is SunOS 4.1.3_u1. 
!     * If it isn't reset, then the shell will not respond to stop signals
!     * from its child when the user hits the job control character ctrl-Z.
!     * The symptom is that the session appears to hang, and can be restarted
!     * by sending kill -CHLD to the login shell after it hangs on the ctrl-Z.
!     */
!    chp = (char *) posignal(SIGCHLD, SIG_DFL, 0);
! 
!    closeLog();				/* must be dead last before exec */
     res  = execve(shell, cargv, cenv);
*** deslogin-1.3/deslogingw.c	Thu Mar  2 12:58:54 1995
--- deslogin-1.33/deslogingw.c	Tue Mar 21 01:36:46 1995
***************
*** 51,53 ****
  static char ident[] = 
! " @(#) deslogingw.c version 1.01 09-Apr-94 Copyright 1994 by Dave Barrett(barrett@asgard.cs.Colorado.EDU)\n";
  
--- 51,53 ----
  static char ident[] = 
! " @(#) deslogingw.c version 1.33 21-Mar-95 Copyright 1994 by Dave Barrett(barrett@asgard.cs.Colorado.EDU)\n";
  
***************
*** 173,175 ****
      */
!    chp = (char *) posignal(SIGINT, sigHandler);
     if (chp == (char *) SIG_ERR) {
--- 173,175 ----
      */
!    chp = (char *) posignal(SIGINT, sigHandler, 0);
     if (chp == (char *) SIG_ERR) {
***************
*** 178,180 ****
     }
!    chp = (char *) posignal(SIGTERM, sigHandler); 
     if (chp == (char *) SIG_ERR) {
--- 178,180 ----
     }
!    chp = (char *) posignal(SIGTERM, sigHandler, 0); 
     if (chp == (char *) SIG_ERR) {
***************
*** 183,185 ****
     }
!    chp = (char *) posignal(SIGHUP, sigHandler); 
     if (chp == (char *) SIG_ERR) {
--- 183,185 ----
     }
!    chp = (char *) posignal(SIGHUP, sigHandler, 0); 
     if (chp == (char *) SIG_ERR) {
*** deslogin-1.3/log.c	Wed Mar  8 15:55:34 1995
--- deslogin-1.33/log.c	Mon Mar 27 13:23:37 1995
***************
*** 15,16 ****
--- 15,18 ----
  #include <sys/types.h>
+ #include <time.h>		/* time() localtime() strftime() struct tms */
+ 				/* NextStep 3.x: stat.h needs time_t in time.h */
  #include <sys/stat.h>		/* S_IRUSR S_IWUSR */
***************
*** 19,21 ****
  #include <errno.h>		/* errno */
- #include <time.h>		/* time() localtime() strftime() struct tms */
  #include <sys/utsname.h>	/* uname() struct utsname */
--- 21,22 ----
*** deslogin-1.3/posignal.c	Thu Mar  2 12:57:41 1995
--- deslogin-1.33/posignal.c	Tue Mar 21 01:39:09 1995
***************
*** 16,22 ****
   * Note also that POSIX SIGCHLD is NOT the same as System V.3 SIGCLD.
   */
  #if defined(__STDC__) || defined(__cplusplus)
! pfv posignal(int sig, pfv handler)
  #else
! pfv posignal(sig, handler) int sig; pfv handler;
  #endif
--- 16,28 ----
   * Note also that POSIX SIGCHLD is NOT the same as System V.3 SIGCLD.
+  *
+  * 21-Mar-95: You cannot set sa_flags to SA_NOCLDSTOP here because of an
+  *            anomoly with SunOS 4.1.3_u1.  This flag is not cleared across
+  *            the exec of the shell in deslogind.c.  The result is that
+  *            the process will hang on ctrl-Z.  This has been moved to
+  *            a separate routine.
   */
  #if defined(__STDC__) || defined(__cplusplus)
! pfv posignal(int sig, pfv handler, int flags)
  #else
! pfv posignal(sig, handler) int sig; pfv handler; int flags;
  #endif
***************
*** 27,29 ****
     sact.sa_handler = handler;	/* some compilers break here; see psignal.h */
!    sact.sa_flags   = SA_NOCLDSTOP;
     sigemptyset(&sact.sa_mask);
--- 33,35 ----
     sact.sa_handler = handler;	/* some compilers break here; see psignal.h */
!    sact.sa_flags   = flags;
     sigemptyset(&sact.sa_mask);
*** deslogin-1.3/posignal.h	Mon May 16 15:34:24 1994
--- deslogin-1.33/posignal.h	Tue Mar 21 01:23:10 1995
***************
*** 27,29 ****
  
! extern pfv posignal(int, pfv);
  #else	/* } { !STDC */
--- 27,29 ----
  
! extern pfv posignal(int, pfv, int);
  #else	/* } { !STDC */
*** deslogin-1.3/socket.c	Thu Mar  2 12:58:17 1995
--- deslogin-1.33/socket.c	Tue Mar 21 01:39:41 1995
***************
*** 338,340 ****
  
!    oldHandler = posignal(SIGCHLD, sockHandler);
     if (oldHandler == (pfv) -1)  {
--- 338,340 ----
  
!    oldHandler = posignal(SIGCHLD, sockHandler, SA_NOCLDSTOP);
     if (oldHandler == (pfv) -1)  {
***************
*** 372,374 ****
  
!    posignal(SIGCHLD, oldHandler);
     close(lsock);
--- 372,374 ----
  
!    posignal(SIGCHLD, oldHandler, SA_NOCLDSTOP);
     close(lsock);
*** deslogin-1.3/tty.c	Thu Mar  2 12:40:06 1995
--- deslogin-1.33/tty.c	Tue Mar 21 01:26:50 1995
***************
*** 327,329 ****
  
!    oldsigint = posignal(SIGINT, restoreEcho);
     oldEcho   = setTtyEcho(ttyfd, echo);
--- 327,329 ----
  
!    oldsigint = posignal(SIGINT, restoreEcho, 0);
     oldEcho   = setTtyEcho(ttyfd, echo);
***************
*** 349,351 ****
     oldEcho = setTtyEcho(ttyfd, oldEcho);
!    posignal(SIGINT, oldsigint);
     close(ttyfd);
--- 349,351 ----
     oldEcho = setTtyEcho(ttyfd, oldEcho);
!    posignal(SIGINT, oldsigint, 0);
     close(ttyfd);
*** deslogin-1.3/txfr.c	Wed Mar  8 15:55:35 1995
--- deslogin-1.33/txfr.c	Tue Mar 21 01:26:11 1995
***************
*** 228,230 ****
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher);
     alarm(timeout / 1000);
--- 228,230 ----
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher, 0);
     alarm(timeout / 1000);
***************
*** 248,250 ****
     alarm(0);
!    posignal(SIGALRM, oldHandler);
     return res;		/* res > 0 for success, < 0 failure, 0 timeout */
--- 248,250 ----
     alarm(0);
!    posignal(SIGALRM, oldHandler, 0);
     return res;		/* res > 0 for success, < 0 failure, 0 timeout */
***************
*** 263,265 ****
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher);
     alarm(timeout / 1000);
--- 263,265 ----
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher, 0);
     alarm(timeout / 1000);
***************
*** 283,285 ****
     alarm(0);
!    posignal(SIGALRM, oldHandler);
     return res;		/* res > 0 for success, < 0 failure, 0 timeout */
--- 283,285 ----
     alarm(0);
!    posignal(SIGALRM, oldHandler, 0);
     return res;		/* res > 0 for success, < 0 failure, 0 timeout */
***************
*** 354,356 ****
     txfrChld = 0;
!    oldChld = posignal(SIGCHLD, chldCatcher);
     if (oldChld == (pfv) -1) {
--- 354,356 ----
     txfrChld = 0;
!    oldChld = posignal(SIGCHLD, chldCatcher, SA_NOCLDSTOP);
     if (oldChld == (pfv) -1) {
***************
*** 463,465 ****
     } while (txfrChld == 0);
!    posignal(SIGCHLD, oldChld);
     setnonblock(fd1, oldblock1);
--- 463,465 ----
     } while (txfrChld == 0);
!    posignal(SIGCHLD, oldChld, SA_NOCLDSTOP);
     setnonblock(fd1, oldblock1);
***************
*** 508,510 ****
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher);
     alarm(seconds);
--- 508,510 ----
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher, 0);
     alarm(seconds);
***************
*** 519,521 ****
     alarm(0);
!    posignal(SIGALRM, oldHandler);
  
--- 519,521 ----
     alarm(0);
!    posignal(SIGALRM, oldHandler, 0);
  
***************
*** 540,542 ****
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher);
     alarm(seconds);
--- 540,542 ----
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher, 0);
     alarm(seconds);
***************
*** 544,546 ****
     alarm(0);
!    posignal(SIGALRM, oldHandler);
  
--- 544,546 ----
     alarm(0);
!    posignal(SIGALRM, oldHandler, 0);
  
***************
*** 575,577 ****
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher);
     alarm(timeout);
--- 575,577 ----
     gotalarm = 0;
!    oldHandler = posignal(SIGALRM, alarmCatcher, 0);
     alarm(timeout);
***************
*** 596,598 ****
     alarm(0);
!    posignal(SIGALRM, oldHandler);
  
--- 596,598 ----
     alarm(0);
!    posignal(SIGALRM, oldHandler, 0);
  
