Subject: Pine/AIX looping fix

From: [email-masked] (Allan L. Bazinet)
Date: Mon, 20 Feb 1995 02:04:21 GMT

We have found the following patch against Pine 3.91's pine/ttyin.c to be
effective in dramatically reducing pine loops on our AIX 3.2.5 systems.
Your mileage may vary; this is only one of several modifications to Pine.

We haven't a clue as to why the patch is effective, nor do we care.  We have
examined .pine-debug files ad nauseum, dealt with a trace interface that is
far from friendly to humans, and run pine under a debugger until grey matter
dripped from our earlobes.  In the end, we determined that the SIGHUP handler
appeared to be working while the select/read EOF/error code in ttyin.c
seemed to be getting into trouble.  We therefore bagged the troublesome
code in favor of signals.c's version of a bailout.

alb

*** ttyin.c.orig	Sun Feb 19 20:43:35 1995
--- ttyin.c	Sun Feb 19 20:43:53 1995
***************
*** 386,413 ****
       if(res <= 0) {
           /* Got an error reading from the terminal. Treat this like
              a SIGHUP: clean up and exit. */
-          dprint(1, (debugfile, "\n\n** Error reading from tty : %s\n\n",
-                 error_description(errno)));
  
!          if(errno == EINTR)
!            return(NO_OP_COMMAND);
  
!          if(ps_global->inbox_stream != NULL){
!              if(ps_global->inbox_stream == ps_global->mail_stream)
!                ps_global->mail_stream = NULL; 
!              mail_close(ps_global->inbox_stream);
!          }
!          if(ps_global->mail_stream != NULL &&
!             ps_global->mail_stream != ps_global->inbox_stream)
!            mail_close(ps_global->mail_stream);
!      
!          MoveCursor(ps_global->ttyo->screen_rows -1, 0);
!          NewLine();
!          end_keyboard(F_ON(F_USE_FK,ps_global));
!          end_tty_driver(ps_global);
!          printf("\n\n\nPine finished. Error reading from terminal: %s\n",
!            error_description(errno));
!          exit(0);
       }
  
       return((int)c);
--- 386,407 ----
       if(res <= 0) {
           /* Got an error reading from the terminal. Treat this like
              a SIGHUP: clean up and exit. */
  
!        if(errno == EINTR)
! 	 return(NO_OP_COMMAND);
  
!        if (res == 0)
! 	 dprint(1, (debugfile, "\n\n** EOF on input tty.\n\n"));
!        else
! 	 dprint(1, (debugfile, "\n\n** Error reading from tty : %s\n\n",
! 		    error_description(errno)));
! 
!        end_signals(1);
!        fast_clean_up();
! 
!        printf("\n\n\nPine finished. Error reading from terminal: %s\n",
! 	      error_description(errno));
!        exit(0);
       }
  
       return((int)c);

----------------------------------------------------------------------------
Allan L. Bazinet                                Ph: (802)656-8785
Computing & Information Technology              FAX:(802)656-8148
University of Vermont   "We look for things"    email:  [email-masked]
Burlington, VT  05405-0160   "to make us go."           [email-masked]