tavoid hang with htmlroff (Michael Teichgräber) - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2b03bf696ca055900ba587d010e731964f56ee3a
(DIR) parent a727811a2c15ab09685d897dcc098d92052bb396
(HTM) Author: rsc <devnull@localhost>
Date: Thu, 12 Oct 2006 02:43:52 +0000
avoid hang with htmlroff (Michael Teichgräber)
Diffstat:
M src/cmd/tcs/utf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/src/cmd/tcs/utf.c b/src/cmd/tcs/utf.c
t@@ -45,7 +45,7 @@ utf_in(int fd, long *notused, struct convert *out)
tot = 0;
while((n = read(fd, buf+tot, N-tot)) >= 0){
tot += n;
- for(i=j=0; i<tot-UTFmax || (n==0 && i<tot); ){
+ for(i=j=0; i<=tot-UTFmax || (i<tot && (n==0 || fullrune(buf+i, tot-i))); ){
c = our_mbtowc(&l, buf+i, tot-i);
if(c == -1){
if(squawk)