+Fri Jan 26 00:37:23 1996 Sam Hartman <hartmans@tertius.mit.edu>
+
+ * krlogin.c (endif
+):
+(reader): Deal with exceptions even while writing.
+
Wed Jan 24 00:34:42 1996 Sam Hartman <hartmans@tertius.mit.edu>
* krlogind.M krshd.M: Update to document new options.
*/
reader(oldmask)
#ifdef POSIX_SIGNALS
- sigset_t *oldmask;
+ sigset_t *oldmask;
#else
int oldmask;
#endif
#else
int pid = -getpid();
#endif
-fd_set readset, excset;
+fd_set readset, excset, writeset;
int n, remaining;
char *bufp = rcvbuf;
ppid = getppid();
FD_ZERO(&readset);
FD_ZERO(&excset);
+ FD_ZERO(&writeset);
#ifdef POSIX_SIGNALS
sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
#else
#endif /* POSIX_SIGNALS */
for (;;) {
- while ((remaining = rcvcnt - (bufp - rcvbuf)) > 0) {
+ if ((remaining = rcvcnt - (bufp - rcvbuf)) > 0)
+ {
+ FD_SET(1,&writeset1);
rcvstate = WRITING;
- n = write(1, bufp, remaining);
- if (n < 0) {
- if (errno != EINTR)
- return (-1);
- continue;
- }
- bufp += n;
+ FD_CLR(rem, &readset);
}
+ else {
+
bufp = rcvbuf;
rcvcnt = 0;
rcvstate = READING;
FD_SET(rem,&readset);
+ FD_CLR(1,&writeset);
+ }
FD_SET(rem,&excset);
if (select(rem+1, &readset, 0, &excset, 0) > 0 ) {
-if (FD_ISSET(rem, &excset))
+ if (FD_ISSET(rem, &excset))
oob();
+ if (FD_ISSET(1,&writeset)) {
+ n = write(1, bufp, remaining);
+ if (n < 0) {
+ if (errno != EINTR)
+ return (-1);
+ continue;
+ }
+ bufp += n;
+}
if (FD_ISSET(rem, &readset)) {
rcvcnt = des_read(rem, rcvbuf, sizeof (rcvbuf));
if (rcvcnt == 0)