block/vvfat.c: remove debugging code to reinit stderr if NULL
PATCH 1/1 block/vvfat.c: remove debugging code to reinit stderr if NULL
Just log to stderr unconditionally, like other similar code does.
--- block/vvfat.c | 5 ----- 1 file changed, 5 deletions(-)
block/vvfat.c +0 -5
@@ -1082,11 +1082,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, vvv = s;#endif -DLOG(if (stderr == NULL) { - stderr =fopen ("vvfat.log" ,"a" ); -setbuf (stderr,NULL ); -}) - opts =qemu_opts_create (&runtime_opts,NULL ,0 , &error_abort);qemu_opts_absorb_qdict (opts, options, &local_err);if (local_err) {
Signature · 1 line
1.7.10.4
Quoted 24 lines · Michael Tokarev
Just log to stderr unconditionally, like other similar code does.
Signed-off-by Michael Tokarev <[email protected]>--- block/vvfat.c | 5 ----- 1 file changed, 5 deletions(-)block/vvfat.c +0
-6@@ -1082,11 +1082,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, vvv = s;#endif -DLOG(if (stderr == NULL) { - stderr =fopen ("vvfat.log" ,"a" ); -setbuf (stderr,NULL ); -}) - opts =qemu_opts_create (&runtime_opts,NULL ,0 , &error_abort);qemu_opts_absorb_qdict (opts, options, &local_err);if (local_err) { --
Quoted 1 line
1.7.10.4
thanks
-- PMM
Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
Quoted 13 lines
Just log to stderr unconditionally, like other similar code does.
Signed-off-by Michael Tokarev <[email protected]>--- block/vvfat.c | 5 ----- 1 file changed, 5 deletions(-)block/vvfat.c +0
-0@@ -1082,11 +1082,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, vvv = s;
block/vvfat.c static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, · line 1087
Quoted 10 lines
block/vvfat.c +0
-5#endif -DLOG(if (stderr == NULL) { - stderr =fopen ("vvfat.log" ,"a" ); -setbuf (stderr,NULL ); -}) - opts =qemu_opts_create (&runtime_opts,NULL ,0 , &error_abort);qemu_opts_absorb_qdict (opts, options, &local_err);if (local_err) {
Michael, it's fine to merge trivial block patches through your tree, but can you please keep Stefan and me CCed anyway?
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;So now you have a lot of fprintf(NULL, ...), which obviously makes qemu segfault as soon as you enable debugging for vvfat.
Kevin
Quoted 7 lines · Kevin Wolf
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;
Yikes. Can we rip that out as well, then?
-- PMM
Quoted 16 lines · Kevin Wolf
Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
block/vvfat.c static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, · line 1089
Quoted 9 lines
Just log to stderr unconditionally, like other similar code does.
block/vvfat.c +0
-5-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:
Quoted 3 lines
#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.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Am 19.08.2014 um 14:06 hat Eric Blake geschrieben:
Quoted 17 lines · Kevin Wolf
Quoted 16 lines
Am 18.08.2014 um 13:41 hat Michael Tokarev geschrieben:
block/vvfat.c static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, · line 1089
Quoted 9 lines
Just log to stderr unconditionally, like other similar code does.
block/vvfat.c +0
-5-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:
Quoted 7 lines
Quoted 3 lines
#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.
I'd vote for just removing this redefine in addition to removing the above hunk, so that everything ends up on the real stderr. But you have to do the whole thing and not just half of it.
Kevin