Received: from eggs.gnu.org ([2001:4830:134:3::10]:54972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL6lh-0007z2-8V for qemu-devel@nongnu.org; Mon, 18 Jan 2016 05:10:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL6lc-0007bz-7k for qemu-devel@nongnu.org; Mon, 18 Jan 2016 05:10:37 -0500 Received: from e06smtp07.uk.ibm.com ([195.75.94.103]:41312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL6lb-0007bt-Ut for qemu-devel@nongnu.org; Mon, 18 Jan 2016 05:10:32 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Jan 2016 10:10:30 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 60C562190019 for ; Mon, 18 Jan 2016 10:10:17 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0IAATD339387284 for ; Mon, 18 Jan 2016 10:10:29 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0I9ATUg007042 for ; Mon, 18 Jan 2016 02:10:29 -0700 Date: Mon, 18 Jan 2016 11:10:25 +0100 From: Cornelia Huck Message-ID: <20160118111025.3c8a1082.cornelia.huck@de.ibm.com> In-Reply-To: <20160118095032.GA13395@redhat.com> References: <1452603559-13685-1-git-send-email-berrange@redhat.com> <569980DC.5030707@redhat.com> <20160118095032.GA13395@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] s390: use FILE instead of QEMUFile for creating text file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, "Jason J. Herne" , Richard Henderson On Mon, 18 Jan 2016 09:50:32 +0000 "Daniel P. Berrange" 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 :)