From: Sam Hartman Date: Fri, 26 Jan 1996 07:02:51 +0000 (+0000) Subject: Fix delay in ^C processing X-Git-Tag: krb5-1.0-beta6~560 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=664516485c6610383af2dd9c0fc4305ed64d8cb7;p=krb5.git Fix delay in ^C processing caused by my OOB fix. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7392 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index ee6df50b7..c7f26b9dc 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,9 @@ +Fri Jan 26 00:37:23 1996 Sam Hartman + + * krlogin.c (endif +): +(reader): Deal with exceptions even while writing. + Wed Jan 24 00:34:42 1996 Sam Hartman * krlogind.M krshd.M: Update to document new options. diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index 0807cd594..34906fe8f 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -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)