pidfile_open incorrectly returns EAGAIN when pidfile is locked

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Mar 13 22:06:58 UTC 2013


On Wed, Mar 13, 2013 at 10:59:17PM +0100, Dirk Engling wrote:
> 
> On Wed, 13 Mar 2013, Pawel Jakub Dawidek wrote:
> 
> > How about this patch?
> >
> > 	http://people.freebsd.org/~pjd/patches/pidfile.c.patch
> 
> If you move the lines
> 
> +				if (errno == 0 || errno == EAGAIN)
> +					errno = EEXIST;
> 
> out of the else branch, you can get rid of the if branch, guard the else 
> branch by a
> 
> +			if (pidptr) {
> 
> and let the if (errno == 0 || errno == EAGAIN) fix the errno

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?

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20130313/f95d038c/attachment.sig>


More information about the freebsd-current mailing list