From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtifF-0005LK-8i for qemu-devel@nongnu.org; Fri, 11 Jan 2013 12:45:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtifB-000494-4Y for qemu-devel@nongnu.org; Fri, 11 Jan 2013 12:45:09 -0500 Received: from mail-ia0-f180.google.com ([209.85.210.180]:61553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtifB-00048N-0H for qemu-devel@nongnu.org; Fri, 11 Jan 2013 12:45:05 -0500 Received: by mail-ia0-f180.google.com with SMTP id f27so391104iae.11 for ; Fri, 11 Jan 2013 09:45:04 -0800 (PST) Sender: fluxion Date: Fri, 11 Jan 2013 11:42:58 -0600 From: mdroth Message-ID: <20130111174258.GJ1543@vm> References: <1357899902-5316-1-git-send-email-armbru@redhat.com> <1357899902-5316-4-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1357899902-5316-4-git-send-email-armbru@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/6] qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com On Fri, Jan 11, 2013 at 11:24:59AM +0100, Markus Armbruster wrote: > Spotted by Coverity. Also document why we keep it open on success. > > Signed-off-by: Markus Armbruster Reviewed-by: Michael Roth > --- > qga/main.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/qga/main.c b/qga/main.c > index 1a22d8d..db47427 100644 > --- a/qga/main.c > +++ b/qga/main.c > @@ -286,10 +286,12 @@ static bool ga_open_pidfile(const char *pidfile) > goto fail; > } > > + /* keep pidfile open & locked forever */ > return true; > > fail: > unlink(pidfile); > + close(pidfd); > return false; > } > #else /* _WIN32 */ > -- > 1.7.11.7 >