From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blvs0-0007pO-Jx for qemu-devel@nongnu.org; Mon, 19 Sep 2016 06:32:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blvru-00050F-JO for qemu-devel@nongnu.org; Mon, 19 Sep 2016 06:32:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49192 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blvru-0004zd-Ep for qemu-devel@nongnu.org; Mon, 19 Sep 2016 06:32:10 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8JAT4xx001849 for ; Mon, 19 Sep 2016 06:32:09 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 25h1u7bjx5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Sep 2016 06:32:08 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Sep 2016 11:32:07 +0100 Date: Mon, 19 Sep 2016 12:32:00 +0200 From: Cornelia Huck In-Reply-To: References: <1474034177-17663-1-git-send-email-lvivier@redhat.com> <20160916153951.GE9654@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20160919123200.7bfecc1f.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 00/26] trivial: use exit(EXIT_SUCCESS) and exit(EXIT_FAILURE) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "Daniel P. Berrange" , Laurent Vivier , QEMU Trivial , QEMU Developers On Fri, 16 Sep 2016 16:45:06 +0100 Peter Maydell wrote: > On 16 September 2016 at 16:39, Daniel P. Berrange wrote: > > On Fri, Sep 16, 2016 at 03:47:37PM +0100, Peter Maydell wrote: > >> On 16 September 2016 at 14:55, Laurent Vivier wrote: > >> > This series is the result of coccinelle patch > >> > scripts/coccinelle/exit.cocci > >> > provided by the first patch of the series. > >> > > >> > It replaces exit(0) by exit(EXIT_SUCCESS) > >> > and exit(1) by exit(EXIT_FAILURE). > >> > > >> > All other exit() are not modified as we don't want > >> > to change the behavior. > >> > > >> > In some cases, I've added manually a line break to comply > >> > with the maximum line length. > >> > >> > 182 files changed, 734 insertions(+), 715 deletions(-) > >> > >> You don't say why this is a useful change to make, and it's an > >> awful lot of churn for a stylistic issue... > > > > Currently QEMU uses a mix of at least > > > > exit(EXIT_SUCCESS) > > exit(EXIT_FAILURE) > > exit(1) > > exit(-1) > > _exit(1) > > _exit(0); > > > > so this series has the potential giving us more consistency style > > and behaviour, across our code. By not fixing the up the usage of -1, > > or fixing the _exit() usage, the series feels incomplete to me though. > > -1 is just a bug which we should fix (as Eric says). I don't > see the point in converting all our 0s and 1s to EXIT_SUCCESS > and EXIT_FAILURE though. (It would be less churn to convert the > uses of EXIT_* to 0 and 1...) Agreed. If we want to make our exit handling more consistent, the first step would be to examine whether doing an exit() is the right thing to do in that code path at all. I'm currently aware at least of some exit()s in the virtio code that need to be converted to real error handling, and I'd not be surprised if similar things were true for other parts of the code.