qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2] s390: use FILE instead of QEMUFile for creating text file
Date: Mon, 18 Jan 2016 11:10:25 +0100	[thread overview]
Message-ID: <20160118111025.3c8a1082.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20160118095032.GA13395@redhat.com>

On Mon, 18 Jan 2016 09:50:32 +0000
"Daniel P. Berrange" <berrange@redhat.com> wrote:

> On Fri, Jan 15, 2016 at 04:29:32PM -0700, Eric Blake wrote:
> > On 01/12/2016 05:59 AM, Daniel P. Berrange wrote:

> > > @@ -124,8 +120,14 @@ void qmp_dump_skeys(const char *filename, Error **errp)
> > >          return;
> > >      }
> > >  
> > > -    f = qemu_fopen(filename, "wb");
> > > +    fd = qemu_open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0600);
> > 
> > A strict conversion should probably include O_BINARY for mingw (where
> > "wb" turns on binary mode).  But maybe we should just make qemu_open()
> > itself _always_ provide O_BINARY so that callers don't have to worry
> > about it - do we really have a reason to open a file on mingw where we
> > want \r\n munged into \n due to text mode?
> 
> We're writing text data to the file, so I figured that using binary
> mode would be wrong.
> 
> > 
> > > +    if (fd < 0) {
> > > +        error_setg_file_open(errp, errno, filename);
> > > +        return;
> > > +    }
> > > +    f = fdopen(fd, "wb");
> > >      if (!f) {
> > > +        close(fd);
> > >          error_setg_file_open(errp, errno, filename);
> > 
> > close() may corrupt errno, resulting in a report of the wrong message.
> > Swap these two lines.
> 
> Ok

Daniel, if you send a respin, could you please put Jason on cc: as
well? He can test this quicker than I can :)

      reply	other threads:[~2016-01-18 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 12:59 [Qemu-devel] [PATCH v2] s390: use FILE instead of QEMUFile for creating text file Daniel P. Berrange
2016-01-15 23:29 ` Eric Blake
2016-01-18  9:50   ` Daniel P. Berrange
2016-01-18 10:10     ` Cornelia Huck [this message]

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=20160118111025.3c8a1082.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=berrange@redhat.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).