Received: from eggs.gnu.org ([140.186.70.92]:45112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqlgQ-0003eF-4q for qemu-devel@nongnu.org; Fri, 27 Jan 2012 08:17:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqlgO-0002Fc-Qb for qemu-devel@nongnu.org; Fri, 27 Jan 2012 08:17:38 -0500 From: Markus Armbruster References: <1327613801-5828-1-git-send-email-lersek@redhat.com> Date: Fri, 27 Jan 2012 14:17:33 +0100 In-Reply-To: <1327613801-5828-1-git-send-email-lersek@redhat.com> (Laszlo Ersek's message of "Thu, 26 Jan 2012 22:36:41 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] 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 Laszlo Ersek writes: > The lockf() call in qemu_create_pidfile() aims at ensuring mutual > exclusion. We shouldn't close the pidfile on success, 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. > > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lockf.html Broken in commit 1bbd1592 by yours truly %-} Suitable pointer could be added to the commit message. > Signed-off-by: Laszlo Ersek > --- > Please keep me CC'd, I'm not subscribed. Thanks! > > os-posix.c | 1 - > 1 files changed, 0 insertions(+), 1 deletions(-) > > diff --git a/os-posix.c b/os-posix.c > index 5c437ca..f4940c8 100644 > --- a/os-posix.c > +++ b/os-posix.c > @@ -348,6 +348,5 @@ int qemu_create_pidfile(const char *filename) > return -1; > } > > - close(fd); > return 0; > } We intentionally leak fd here. A comment would be nice. Reviewed-by: Markus Armbruster