Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2013 12:50:59 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        Dirk Engling <erdgeist@erdgeist.org>, freebsd-current@freebsd.org
Subject:   Re: pidfile_open incorrectly returns EAGAIN when pidfile is locked
Message-ID:  <201303141250.59521.jhb@freebsd.org>
In-Reply-To: <20130314162958.GD1344@garage.freebsd.pl>
References:  <513F8D20.2050707@erdgeist.org> <201303140942.40945.jhb@freebsd.org> <20130314162958.GD1344@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, March 14, 2013 12:29:58 pm Pawel Jakub Dawidek wrote:
> On Thu, Mar 14, 2013 at 09:42:40AM -0400, John Baldwin wrote:
> > On Thursday, March 14, 2013 4:44:20 am Pawel Jakub Dawidek wrote:
> > > On Thu, Mar 14, 2013 at 08:28:25AM +0100, Dirk Engling wrote:
> > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > Hash: SHA1
> > > > 
> > > > On 13.03.13 23:08, Pawel Jakub Dawidek wrote:
> > > > 
> > > > > I think I considered something similar at first, but the change I 
> > > > > proposed was optimal, IMHO at the cost of producing pretty large
> > > > > diff, because of indentation change. But to be sure, can you send a
> > > > > patch of your proposed change?
> > > > 
> > > > http://erdgeist.org/arts/software/Code/pidfile.c.diff
> > > 
> > > Right. Your patch assumes EWOULDBLOCK is equal to EAGAIN, which is true
> > > on FreeBSD, but is not portable. Also in case pidptr is NULL you compare
> > > errno three times instead of just one (not a big deal of course, just
> > > something that could be done a bit more optimal:)).
> > 
> > Geeze, why not just add an else.  That's the really short diff:
> 
> Heh, I did consider that as well, but here you check errno twice,
> instead of once. Guys, is there anything wrong with the patch I
> proposed?

I'm sure the compiler can work that out just fine and it should do whatever
is most readable to the programmer.  I don't care either way.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303141250.59521.jhb>