diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2012-12-03 22:05:47 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2012-12-03 22:05:47 +0000 |
commit | eaec9eb8090f0584f61f8e0c0dc2a320936ac897 (patch) | |
tree | f758da9a912c963cc5f7740587f29988c5818269 /usr.bin/vi/ex | |
parent | bcf280fc4dffdbbac796e3c7204623834c6c2dec (diff) |
Fix hang when exiting shell in script mode. OK naddy@
Diffstat (limited to 'usr.bin/vi/ex')
-rw-r--r-- | usr.bin/vi/ex/ex_script.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/vi/ex/ex_script.c b/usr.bin/vi/ex/ex_script.c index b551fab3ae2..2b12f314e1e 100644 --- a/usr.bin/vi/ex/ex_script.c +++ b/usr.bin/vi/ex/ex_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ex_script.c,v 1.16 2009/10/27 23:59:47 deraadt Exp $ */ +/* $OpenBSD: ex_script.c,v 1.17 2012/12/03 22:05:46 millert Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -416,8 +416,11 @@ loop: nfds = 1; CIRCLEQ_FOREACH(tsp, &gp->dq, q) if (F_ISSET(sp, SC_SCRIPT)) { - if ((pfd[nfds++].revents & POLLIN) && sscr_insert(sp)) + if ((pfd[nfds].revents & POLLHUP) && sscr_end(sp)) goto done; + if ((pfd[nfds].revents & POLLIN) && sscr_insert(sp)) + goto done; + nfds++; } goto loop; } @@ -482,8 +485,11 @@ loop: nfds = 0; CIRCLEQ_FOREACH(sp, &gp->dq, q) if (F_ISSET(sp, SC_SCRIPT)) { - if ((pfd[nfds++].revents & POLLIN) && sscr_insert(sp)) + if ((pfd[nfds].revents & POLLHUP) && sscr_end(sp)) + goto done; + if ((pfd[nfds].revents & POLLIN) && sscr_insert(sp)) goto done; + nfds++; } goto loop; done: |