qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: mdroth <mdroth@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 03/10] qemu-ga: qmp_guest_file_*: improve error reporting
Date: Wed, 28 Nov 2012 16:17:43 -0600	[thread overview]
Message-ID: <20121128221743.GO8690@vm> (raw)
In-Reply-To: <1778936997.15910323.1354137989662.JavaMail.root@redhat.com>

On Wed, Nov 28, 2012 at 04:26:29PM -0500, Eric Blake wrote:
> 
> > > >      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).

Well, if it's primarilly an issue with windows, then I think we're okay
relying on it for anything in qga/commands-posix.c at least, as those
implementations get swapped out for the implementations in
qga/commands-win32.o for win32/mingw builds. We'll need to be wary of
this in the future if we end up sharing more code with the win32 port
becomes more feature-full though.

The comment elsewhere about setmntent() might still apply however.

> 
> > 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 :)
> 

  reply	other threads:[~2012-11-28 22:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 13:01 [Qemu-devel] [PATCH 00/10] qemu-ga: revamp error messages (for 1.4) Luiz Capitulino
2012-11-27 13:01 ` [Qemu-devel] [PATCH 01/10] qemu-ga: guest_file_handle_find(): take an Error argument Luiz Capitulino
2012-11-28 17:01   ` mdroth
2012-11-27 13:01 ` [Qemu-devel] [PATCH 02/10] qemu-ga: qmp_guest_file_close(): fix fclose() error check Luiz Capitulino
2012-11-28 17:02   ` mdroth
2012-11-27 13:01 ` [Qemu-devel] [PATCH 03/10] qemu-ga: qmp_guest_file_*: improve error reporting Luiz Capitulino
2012-11-28 17:54   ` mdroth
2012-11-28 19:31     ` Luiz Capitulino
2012-11-28 21:26       ` Eric Blake
2012-11-28 22:17         ` mdroth [this message]
2012-11-29 12:00           ` Luiz Capitulino
2012-11-27 13:01 ` [Qemu-devel] [PATCH 04/10] qemu-ga: qmp_guest_shutdown(): " Luiz Capitulino
2012-11-28 19:27   ` mdroth
2012-11-27 13:01 ` [Qemu-devel] [PATCH 05/10] qemu-ga: build_fs_mount_list(): take an Error argument Luiz Capitulino
2012-11-28 19:34   ` mdroth
2012-11-29 17:29   ` [Qemu-devel] [PATCH v2 " Luiz Capitulino
2012-11-27 13:02 ` [Qemu-devel] [PATCH 06/10] qemu-ga: qmp_guest_fsfreeze_*(): get rid of sprintf() + error_set() Luiz Capitulino
2012-11-28 19:40   ` mdroth
2012-11-27 13:02 ` [Qemu-devel] [PATCH 07/10] qemu-ga: qmp_guest_fstrim(): " Luiz Capitulino
2012-11-28 19:41   ` mdroth
2012-11-27 13:02 ` [Qemu-devel] [PATCH 08/10] qemu-ga: qmp_guest_network_get_interfaces(): get rid of snprintf() " Luiz Capitulino
2012-11-28 19:43   ` mdroth
2012-11-27 13:02 ` [Qemu-devel] [PATCH 09/10] qemu-ga: bios_supports_mode(): improve error reporting Luiz Capitulino
2012-11-28 19:48   ` mdroth
2012-11-27 13:02 ` [Qemu-devel] [PATCH 10/10] qemu-ga: guest_suspend(): " Luiz Capitulino
2012-11-28 19:49   ` mdroth
2012-11-28 20:04 ` [Qemu-devel] [PATCH 00/10] qemu-ga: revamp error messages (for 1.4) mdroth
2012-11-28 20:12   ` mdroth
2012-12-12  1:03   ` Eric Blake
2012-11-30 18:22 ` mdroth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121128221743.GO8690@vm \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).