Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 beta 3/9/83; site cca.UUCP
Path: utzoo!linus!decvax!cca!joe
From: joe@cca.UUCP (Joseph Chapman)
Newsgroups: net.emacs
Subject: Re: CCA Emacs subshells
Message-ID: <1192@cca.UUCP>
Date: Wed, 26-Dec-84 10:48:44 EST
Article-I.D.: cca.1192
Posted: Wed Dec 26 10:48:44 1984
Date-Received: Thu, 27-Dec-84 06:20:09 EST
Organization: Computer Corp America, Cambridge
Lines: 60

<>

Here is a bug fix which solves the problem of a buffer shell in CCA
Emacs hanging the terminal when exited.  The problem was that Emacs was
hanging around forever trying to successfully read a stream which had
disappeared (second part of the fix below).  I also stumbled upon a
nasty infinite loop possibility in fflush; the function error() calls
getchar(), and if the latter encounters an error while doing its stuff
it calls error() and getchar() and so forth.  The terminal bell rings so
many times you want to put your fist through the screen.  Anyway, that's
the reason for the first part of the fix below.

*** e_io.c~	
--- e_io.c
***************
*** 813,821
  				(void) error(WARN, errno, "DCL mailbox");
  		} else
  #endif
! 		if (write(p->_file, p->_buf, p->_cnt) != p->_cnt)
! 			if (p != stdout && errno != 32)
! 				(void) error(WARN, errno, "fflush");
  		p->_cnt = 0;
  	}
  }

--- 813,819 -----
  				(void) error(WARN, errno, "DCL mailbox");
  		} else
  #endif
! 		write(p->_file, p->_buf, p->_cnt);
  		p->_cnt = 0;
  	}
  }
***************
*** 841,847
  		p->_buf[p->_cnt] = '\0';
  	} else
  #endif
! 		while((p->_cnt = read(p->_file, p->_buf, BSIZE)) < 0);
  	p->_skpos += p->_cnt;
  	p->_ptr = p->_buf + 1;
  	if (p->_cnt > 0) {

--- 839,848 -----
  		p->_buf[p->_cnt] = '\0';
  	} else
  #endif
! 		while((p->_cnt = read(p->_file, p->_buf, BSIZE)) < 0) {
!                         if (errno)
!                                 return (EOF);
!                 } 
  	p->_skpos += p->_cnt;
  	p->_ptr = p->_buf + 1;
  	if (p->_cnt > 0) {
  
-- Joseph Chapman                  decvax!cca!joe
   CCA Uniworks, Inc.              joe@cca-unix.ARPA
   20 William St.
   Wellesley, MA  02181            (617) 235-2600