From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFluW-000800-Sa for qemu-devel@nongnu.org; Tue, 18 Feb 2014 09:44:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFluN-0001yY-I6 for qemu-devel@nongnu.org; Tue, 18 Feb 2014 09:44:36 -0500 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:44143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFluN-0001wL-8y for qemu-devel@nongnu.org; Tue, 18 Feb 2014 09:44:27 -0500 Received: by mail-wg0-f51.google.com with SMTP id n12so3296428wgh.18 for ; Tue, 18 Feb 2014 06:44:26 -0800 (PST) Date: Tue, 18 Feb 2014 15:44:23 +0100 From: Stefan Hajnoczi Message-ID: <20140218144423.GC15348@stefanha-thinkpad.redhat.com> References: <1392651898-16749-1-git-send-email-stefanha@redhat.com> <1392651898-16749-4-git-send-email-stefanha@redhat.com> <878ut9u1k4.fsf@blackfin.pond.sub.org> <20140218091746.GC32585@stefanha-thinkpad.redhat.com> <87zjloiw2b.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zjloiw2b.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH 3/3] qtest: kill QEMU process on g_assert() failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , Anthony Liguori , Andreas Faerber , Stefan Hajnoczi , qemu-devel@nongnu.org On Tue, Feb 18, 2014 at 10:55:56AM +0100, Markus Armbruster wrote: > Stefan Hajnoczi writes: > > > On Mon, Feb 17, 2014 at 05:49:31PM +0100, Markus Armbruster wrote: > >> Stefan Hajnoczi writes: > >> > if (s->qemu_pid != -1) { > >> > kill(s->qemu_pid, SIGTERM); > >> > waitpid(s->qemu_pid, &status, 0); > >> > } > >> > > >> > - close(s->fd); > >> > - close(s->qmp_fd); > >> > + if (s->fd != -1) { > >> > + close(s->fd); > >> > + } > >> > + if (s->qmp_fd != -1) { > >> > + close(s->qmp_fd); > >> > + } > >> > >> I generally don't bother to avoid close(-1). > > > > When I drive on the highway I stay on the lanes but I guess I could just > > slide along the side barriers :). It's a style issue but close(-1) > > annoys me in strace so I try to avoid doing it. > > For me, it's in the same category as free(NULL). Understood. I'll drop it from the next patch.