From owner-freebsd-current@FreeBSD.ORG Wed Mar 13 21:59:27 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 41A5EDEE for ; Wed, 13 Mar 2013 21:59:27 +0000 (UTC) (envelope-from erdgeist@erdgeist.org) Received: from elektropost.org (elektropost.org [217.13.206.130]) by mx1.freebsd.org (Postfix) with ESMTP id 960C5F95 for ; Wed, 13 Mar 2013 21:59:26 +0000 (UTC) Received: (qmail 4149 invoked from network); 13 Mar 2013 21:59:18 -0000 Received: from elektropost.org (HELO elektropost.org) (erdgeist@erdgeist.org) by elektropost.org with AES256-SHA encrypted SMTP; 13 Mar 2013 21:59:18 -0000 Date: Wed, 13 Mar 2013 22:59:17 +0100 (CET) From: Dirk Engling To: Pawel Jakub Dawidek Subject: Re: pidfile_open incorrectly returns EAGAIN when pidfile is locked In-Reply-To: <20130313212750.GC1372@garage.freebsd.pl> Message-ID: References: <513F8D20.2050707@erdgeist.org> <201303131118.36811.jhb@freebsd.org> <20130313212750.GC1372@garage.freebsd.pl> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2013 21:59:27 -0000 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 Regards, erdgeist