Fix delay in ^C processing
authorSam Hartman <hartmans@mit.edu>
Fri, 26 Jan 1996 07:02:51 +0000 (07:02 +0000)
committerSam Hartman <hartmans@mit.edu>
Fri, 26 Jan 1996 07:02:51 +0000 (07:02 +0000)
caused by my OOB fix.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7392 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/bsd/ChangeLog
src/appl/bsd/krlogin.c

index ee6df50b761a5fb151a623198a0b9c06f9331226..c7f26b9dc5fd2a9264faf85f7498deb7a1a99b6c 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 0807cd5948546b40305f770a31db394528201621..34906fe8f21c1cc6bac31505c5291862de53c220 100644 (file)
@@ -1295,7 +1295,7 @@ return;
  */
 reader(oldmask)
 #ifdef POSIX_SIGNALS
-     sigset_t *oldmask;
+    sigset_t *oldmask;
 #else
      int oldmask;
 #endif
@@ -1305,7 +1305,7 @@ reader(oldmask)
 #else
     int pid = -getpid();
 #endif
-fd_set readset, excset;
+fd_set readset, excset, writeset;
     int n, remaining;
     char *bufp = rcvbuf;
 
@@ -1324,6 +1324,7 @@ fd_set readset, excset;
     ppid = getppid();
 FD_ZERO(&readset);
     FD_ZERO(&excset);
+    FD_ZERO(&writeset);
 #ifdef POSIX_SIGNALS
     sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
 #else
@@ -1333,24 +1334,33 @@ FD_ZERO(&readset);
 #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)