From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ0St-0001xK-GM for qemu-devel@nongnu.org; Tue, 02 Oct 2012 07:16:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ0Sn-0001q5-Q1 for qemu-devel@nongnu.org; Tue, 02 Oct 2012 07:16:39 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:53660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ0Sn-0001p8-JZ for qemu-devel@nongnu.org; Tue, 02 Oct 2012 07:16:33 -0400 Received: by padfb10 with SMTP id fb10so5210685pad.4 for ; Tue, 02 Oct 2012 04:16:31 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <506ACD08.3080206@redhat.com> Date: Tue, 02 Oct 2012 13:16:24 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1348217255-22441-1-git-send-email-quintela@redhat.com> <1348217255-22441-26-git-send-email-quintela@redhat.com> <505C60FF.70205@redhat.com> <871uhh9lqt.fsf@elfo.mitica> In-Reply-To: <871uhh9lqt.fsf@elfo.mitica> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 25/41] buffered_file: make buffered_flush return the error code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com Cc: qemu-devel@nongnu.org Il 02/10/2012 13:06, Juan Quintela ha scritto: >> Perhaps the other way round: >> > >> > if (ret < 0) { >> > ret2 = -1; >> > } >> > ... >> > return ret2; > This lost the 1st errno value. Right, I meant ret2 = ret; > The other way around we preserve it. I think with "ret2 = ret;" it is the same. The way you have it in your patch, you could truncate a positive ssize_t return value from buffered_flush that does not fit in an int. Theoretical, I know, but I can see Coverity spotting it from a mile... Paolo