From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1033 Path: news.gmane.org!not-for-mail From: Gerrit Pape Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: timeout chpst -L Date: Tue, 14 Feb 2006 10:36:25 +0000 Message-ID: <20060214103625.4267.qmail@65cebaedea5163.315fe32.mid.smarden.org> References: <20060213163054.GC2511@home.power> <20060213201807.GF6585@home.power> <20060214084509.24951.qmail@125e08fe97c020.315fe32.mid.smarden.org> <20060214102323.GL6585@home.power> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="7ZAtKRhVyVSsbBD2" X-Trace: sea.gmane.org 1139913372 22591 80.91.229.2 (14 Feb 2006 10:36:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Feb 2006 10:36:12 +0000 (UTC) Original-X-From: supervision-return-1269-gcsg-supervision=m.gmane.org@list.skarnet.org Tue Feb 14 11:36:10 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1F8xXR-0008AO-Gs for gcsg-supervision@gmane.org; Tue, 14 Feb 2006 11:36:05 +0100 Original-Received: (qmail 14694 invoked by uid 76); 14 Feb 2006 10:36:27 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 14689 invoked from network); 14 Feb 2006 10:36:26 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline In-Reply-To: <20060214102323.GL6585@home.power> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1033 Archived-At: --7ZAtKRhVyVSsbBD2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 14, 2006 at 12:23:23PM +0200, Alex Efros wrote: > On Tue, Feb 14, 2006 at 08:45:09AM +0000, Gerrit Pape wrote: > > Yes, it's a race, the patch below should help. Thanks, Gerrit. > > Thanks, patch works. But I've found another bug, sorry. Now '-n' option > don't work: Yes, it's the same race, different impact. Can you try this slightly extended patch? Thanks, Gerrit. --7ZAtKRhVyVSsbBD2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Index: src/tryto.c =================================================================== RCS file: /var/lib/cvs/socklog/src/tryto.c,v retrieving revision 1.8 diff -u -r1.8 tryto.c --- src/tryto.c 6 Feb 2005 11:36:50 -0000 1.8 +++ src/tryto.c 14 Feb 2006 10:33:59 -0000 @@ -104,6 +104,7 @@ taia_now(&now); taia_uint(&deadline, timeout); taia_add(&deadline, &now, &deadline); + timeout =0; for (;;) { int iopausefds; @@ -163,15 +164,15 @@ int i; char *s; - if (wait_nohang(&rc) == pid) break; - taia_now(&now); - if ((timeout =taia_less(&deadline, &now))) break; - sig_unblock(sig_child); iopause(x, iopausefds, &deadline, &now); sig_block(sig_child); while (read(selfpipe[0], &ch, 1) == 1) {} + + if (wait_nohang(&rc) == pid) break; + taia_now(&now); + if ((timeout =taia_less(&deadline, &now))) break; r = buffer_feed(&buffer_x); if (r < 0) { --7ZAtKRhVyVSsbBD2--