qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org, Li Liu <john.liuli@huawei.com>,
	qemu-devel@nongnu.org, stefanha@redhat.com,
	zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: Re: [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL
Date: Tue, 19 Aug 2014 06:06:56 -0600	[thread overview]
Message-ID: <53F33DE0.9040700@redhat.com> (raw)
In-Reply-To: <20140819115823.GD4638@noname.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

On 08/19/2014 05:58 AM, Kevin Wolf wrote:
> Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
>> Just log to stderr unconditionally, like other similar code does.
>>

>>  
>> -DLOG(if (stderr == NULL) {
>> -    stderr = fopen("vvfat.log", "a");
>> -    setbuf(stderr, NULL);
>> -})
>> -

> 
> This specific patch isn't as trivial as it might look at the first
> sight (in other words: it's wrong). The part that you probably missed is
> that stderr isn't the real one when DEBUG is set:
> 
>     #undef stderr
>     #define stderr STDERR
>     FILE* stderr = NULL;

Eeek, that's horrible.  I'd rather see code doing freopen("vvfat.log",
"a", stderr) than the current horrid mess of redefining stderr away from
its normal meaning.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

  parent reply	other threads:[~2014-08-19 12:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 11:41 [Qemu-devel] [PATCH] block/vvfat.c: remove debugging code to reinit stderr if NULL Michael Tokarev
2014-08-18 11:45 ` Peter Maydell
2014-08-19 11:58 ` Kevin Wolf
2014-08-19 12:02   ` Peter Maydell
2014-08-19 12:06   ` Eric Blake [this message]
2014-08-19 12:25     ` Kevin Wolf

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=53F33DE0.9040700@redhat.com \
    --to=eblake@redhat.com \
    --cc=john.liuli@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /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).