From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdpA5-00034v-Kl for qemu-devel@nongnu.org; Wed, 28 Nov 2012 16:27:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdpA4-0006qC-KX for qemu-devel@nongnu.org; Wed, 28 Nov 2012 16:27:17 -0500 Received: from mx3-phx2.redhat.com ([209.132.183.24]:56843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdpA4-0006q6-Cr for qemu-devel@nongnu.org; Wed, 28 Nov 2012 16:27:16 -0500 Date: Wed, 28 Nov 2012 16:26:29 -0500 (EST) From: Eric Blake Message-ID: <1778936997.15910323.1354137989662.JavaMail.root@redhat.com> In-Reply-To: <20121128173155.7612b1a4@doriath.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/10] qemu-ga: qmp_guest_file_*: improve error reporting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org, mdroth > > > if (ferror(fh)) { > > > + error_setg_errno(err, errno, "failed to read file"); > > > slog("guest-file-read failed, handle: %ld", handle); > > > - error_set(err, QERR_QGA_COMMAND_FAILED, "fread() > > > failed"); > > > } else { > > > > I'm not sure about relying on errno for FILE/f*() functions. C99 > > doesn't > > appear to require setting it for implementations Correct that C99 doesn't require it, but POSIX _does_ require it. Windows is the biggest system out there where errno is unreliable after failure on FILE operations (but as we DO support mingw, we ARE impacted by the lameness of Microsoft's C library being C89 but not POSIX). > However, the other FILE functions seem safe to me. I'd be very > surprised > if some implementation doesn't set errno on fopen() failure for > example Then you probably haven't experimented much with mingw :)