diff options
| author | Araki Ken <arakiken@users.sf.net> | 2013-03-13 20:18:13 +0000 | 
|---|---|---|
| committer | Tatsuya Kinoshita <tats@debian.org> | 2014-12-06 11:47:04 +0000 | 
| commit | f941b1d562cee6a08001e164a1e37d0a925e438b (patch) | |
| tree | 5149a2ef3ed8c8e7296fd8b27a893dabb794e68c | |
| parent | * file.c: nw and ni are rounded up instead of rounded off to show every corne... (diff) | |
| download | w3m-f941b1d562cee6a08001e164a1e37d0a925e438b.tar.gz w3m-f941b1d562cee6a08001e164a1e37d0a925e438b.zip | |
* terms.c: Clear fd_set by FD_ZERO() before select().
| -rw-r--r-- | terms.c | 15 | 
1 files changed, 7 insertions, 8 deletions
| @@ -499,17 +499,16 @@ get_pixel_per_cell(int *ppc, int *ppl)      p = buf;      left = sizeof(buf) - 1; -    for (i = 0; i < 5; i++) { -	tval.tv_usec = 500000;	/* 0.5 sec */ +    for (i = 0; i < 10; i++) { +	tval.tv_usec = 200000;	/* 0.2 sec * 10 */  	tval.tv_sec = 0; +	FD_ZERO(&rfd);  	FD_SET(tty,&rfd); -	if (select(tty+1,&rfd,NULL,NULL,&tval) <= 0 || ! FD_ISSET(tty,&rfd)) { +	if (select(tty+1,&rfd,NULL,NULL,&tval) <= 0 || ! FD_ISSET(tty,&rfd))  	    continue; -	} -	if ((len = read(tty,p,left)) <= 0) { -	    return 0; -	} +	if ((len = read(tty,p,left)) <= 0) +	    continue;  	p[len] = '\0';  	if (sscanf(buf,"\x1b[4;%d;%dt\x1b[8;%d;%dt",&hp,&wp,&hc,&wc) == 4) { @@ -518,7 +517,7 @@ get_pixel_per_cell(int *ppc, int *ppl)  	    return 1;  	} -	p = buf + len; +	p += len;  	left -= len;      } | 
