From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtMpL-0002aQ-JU for qemu-devel@nongnu.org; Fri, 03 Feb 2012 12:21:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtMpF-0001FC-9q for qemu-devel@nongnu.org; Fri, 03 Feb 2012 12:21:35 -0500 Message-ID: <4F2C1793.8090907@redhat.com> Date: Fri, 03 Feb 2012 11:21:23 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1327671245-5231-1-git-send-email-lersek@redhat.com> In-Reply-To: <1327671245-5231-1-git-send-email-lersek@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] keep the PID file locked for the lifetime of the process List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, armbru@redhat.com On 01/27/2012 07:34 AM, Laszlo Ersek wrote: > The lockf() call in qemu_create_pidfile() aims at ensuring mutual > exclusion. We shouldn't close the pidfile on success (as introduced by > commit 1bbd1592), because that drops the lock as well [1]: > > "File locks shall be released on first close by the locking process > of any file descriptor for the file." > > Coverity may complain again about the leaked file descriptor; let's > worry about that later. > > v1->v2: > - add reference to 1bbd1592 > - explain the intentional fd leak in the source > > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lockf.html Applied. Thanks. Regards, Anthony Liguori > > Signed-off-by: Laszlo Ersek > --- > os-posix.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/os-posix.c b/os-posix.c > index 5c437ca..e3ed497 100644 > --- a/os-posix.c > +++ b/os-posix.c > @@ -348,6 +348,6 @@ int qemu_create_pidfile(const char *filename) > return -1; > } > > - close(fd); > + /* keep pidfile open& locked forever */ > return 0; > }