diff options
author | 2012-12-03 22:05:46 +0000 | |
---|---|---|
committer | 2012-12-03 22:05:46 +0000 | |
commit | 342e41ceab3e57bb8b9bbc5caec94e6cc883c0be (patch) | |
tree | ee6a0cf95a6c7b848173d95f5ce527c670bbb3b5 | |
parent | wrap bpf.h header with NBPFILTER (diff) | |
download | wireguard-openbsd-342e41ceab3e57bb8b9bbc5caec94e6cc883c0be.tar.xz wireguard-openbsd-342e41ceab3e57bb8b9bbc5caec94e6cc883c0be.zip |
Fix hang when exiting shell in script mode. OK naddy@
-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: |