From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6078 invoked from network); 7 May 2004 15:42:00 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 7 May 2004 15:42:00 -0000 Received: (qmail 21941 invoked from network); 7 May 2004 15:41:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 May 2004 15:41:50 -0000 Received: (qmail 26664 invoked by alias); 7 May 2004 15:41:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19893 Received: (qmail 26654 invoked from network); 7 May 2004 15:41:47 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 7 May 2004 15:41:44 -0000 Received: (qmail 21723 invoked from network); 7 May 2004 15:41:44 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO binome.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 7 May 2004 15:41:42 -0000 Received: by binome.blorf.net (Postfix, from userid 1000) id 0FBA04AE; Fri, 7 May 2004 08:41:40 -0700 (PDT) Date: Fri, 7 May 2004 08:41:40 -0700 From: Wayne Davison To: KELEMEN Peter , zsh-workers@sunsite.dk Subject: Re: [4.2.0] Src/hist.c:lockhistfile() endless loop Message-ID: <20040507154140.GB29221@blorf.net> References: <20040507103515.GE12559@chihiro.cern.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <20040507103515.GE12559@chihiro.cern.ch> User-Agent: Mutt/1.5.5.1+cvs20040105i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, May 07, 2004 at 12:35:15PM +0200, KELEMEN Peter wrote: > This looks like an endless loop if > 1) link() fails, and > 2) stat() returns -ENOENT. Seems to me that the attached change would avoid the infinite loop in the failure case you cite. ..wayne.. --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="lockfile.patch" --- Src/hist.c 29 Oct 2003 19:17:30 -0000 1.47 +++ Src/hist.c 7 May 2004 15:39:44 -0000 @@ -2139,7 +2139,9 @@ lockhistfile(char *fn, int keep_trying) write(fd, tmpfile+len+1, strlen(tmpfile+len+1)); close(fd); while (link(tmpfile, lockfile) < 0) { - if (stat(lockfile, &sb) < 0) { + if (errno != EEXIST) + ; + else if (stat(lockfile, &sb) < 0) { if (errno == ENOENT) continue; } --FCuugMFkClbJLl1L--