Date: Sun, 02 Jul 2000 20:06:41 +0100 From: Ben Smithurst <ben@scientia.demon.co.uk> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/19652: patch for wwwoffle port (wwwoffled not retrying select() call) Message-ID: <E138p4j-000FKk-00@magnesium.scientia.demon.co.uk>
next in thread | raw e-mail | index | archive | help
>Number: 19652 >Category: ports >Synopsis: patch for wwwoffle port (wwwoffled not retrying select() call) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jul 02 13:10:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Ben Smithurst >Release: FreeBSD 3.4-STABLE i386 >Organization: >Environment: >Description: The wwwoffled program in the www/wwwoffle port doesn't retry a select() call when select() fails with EINTR, which it should do. This causes problems such as a 'wwwoffle -offline' command not taking effect which can be annoying. This patch has been sent to the WWWOFFLE author, so it will probably be included in the next release (or a patch with equivalent functionality at least), but as that may be a while this patch should probably be added to patches/patch-ac (or something) until then. >How-To-Repeat: >Fix: --- io.c.orig Sun Jan 2 19:55:12 2000 +++ io.c Mon May 29 20:40:30 2000 @@ -135,14 +135,17 @@ fd_set readfd; struct timeval tv; - FD_ZERO(&readfd); - - FD_SET(fd,&readfd); - - tv.tv_sec=tv.tv_usec=0; - - if(select(fd+1,&readfd,NULL,NULL,&tv)<=0) - return(nr); + while(1) + { + tv.tv_sec=tv.tv_usec=0; + FD_ZERO(&readfd); + FD_SET(fd,&readfd); + n=select(fd+1,&readfd,NULL,NULL,&tv); + if(n>0) + break; + if(n==0 || errno!=EINTR) + return(nr); + } n=read(fd,fdbuf[fd],BUFSIZE); @@ -206,15 +209,18 @@ fd_set readfd; struct timeval tv; - FD_ZERO(&readfd); - - FD_SET(fd,&readfd); - - tv.tv_sec=timeout; - tv.tv_usec=0; - - if(select(fd+1,&readfd,NULL,NULL,&tv)<=0) - return(-1); + while(1) + { + tv.tv_sec=timeout; + tv.tv_usec=0; + FD_ZERO(&readfd); + FD_SET(fd,&readfd); + nr=select(fd+1,&readfd,NULL,NULL,&tv); + if(nr>0) + break; + if(nr==0 || errno!=EINTR) + return(-1); + } nr=read(fd,buffer,n); } @@ -364,15 +370,18 @@ fd_set readfd; struct timeval tv; - FD_ZERO(&readfd); - - FD_SET(fd,&readfd); - - tv.tv_sec=timeout; - tv.tv_usec=0; - - if(select(fd+1,&readfd,NULL,NULL,&tv)<=0) - return(-1); + while(1) + { + tv.tv_sec=timeout; + tv.tv_usec=0; + FD_ZERO(&readfd); + FD_SET(fd,&readfd); + n=select(fd+1,&readfd,NULL,NULL,&tv); + if(n>0) + break; + if(n==0 || errno!=EINTR) + return(-1); + } n=read(fd,fdbuf[fd]+fdbytes[fd],BUFSIZE-fdbytes[fd]); fdbytes[fd]+=n; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E138p4j-000FKk-00>