Re: [libvirt] [PATCH 1/4] Make vshDebug work when parsing parameters
On 03/14/2013 06:15 PM, Daniel P. Berrange wrote: On Thu, Mar 14, 2013 at 10:27:32AM +0100, Martin Kletzander wrote: The vshInit initializes ctl-debug by which vshDebug (which is also called in vshParseArgv) decides whether to print out the message or not. Signed-off-by: Martin Kletzander mklet...@redhat.com --- tools/virsh.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..9ed038a 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,15 +3100,13 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); Hmm, we previously called vshDeinit() even though we'd not got to vshInit yet ! exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { -vshDeinit(ctl); +if (!vshParseArgv(ctl, argc, argv)) But here you've lost the vshDeinit now. I think we need to put that back to keep valgrind happy, don't we ? Or is there some reason which forced to you drop the vshDeinit here ? No reason, just my fault. I removed it at first when the vshParseArgv was before vshInit and then switched those two without adding it back, thanks for noticing. This is how the patch should've looked like: diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..58a604b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,12 +3100,12 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { +if (!vshParseArgv(ctl, argc, argv)) { vshDeinit(ctl); exit(EXIT_FAILURE); } -- exit(EXIT_FAILURE); -} Regards Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] Make vshDebug work when parsing parameters
On Fri, Mar 15, 2013 at 02:10:08PM +0100, Martin Kletzander wrote: On 03/14/2013 06:15 PM, Daniel P. Berrange wrote: On Thu, Mar 14, 2013 at 10:27:32AM +0100, Martin Kletzander wrote: The vshInit initializes ctl-debug by which vshDebug (which is also called in vshParseArgv) decides whether to print out the message or not. Signed-off-by: Martin Kletzander mklet...@redhat.com --- tools/virsh.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..9ed038a 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,15 +3100,13 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); Hmm, we previously called vshDeinit() even though we'd not got to vshInit yet ! exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { -vshDeinit(ctl); +if (!vshParseArgv(ctl, argc, argv)) But here you've lost the vshDeinit now. I think we need to put that back to keep valgrind happy, don't we ? Or is there some reason which forced to you drop the vshDeinit here ? No reason, just my fault. I removed it at first when the vshParseArgv was before vshInit and then switched those two without adding it back, thanks for noticing. This is how the patch should've looked like: diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..58a604b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,12 +3100,12 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { +if (!vshParseArgv(ctl, argc, argv)) { vshDeinit(ctl); exit(EXIT_FAILURE); } ACK Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] Make vshDebug work when parsing parameters
On 03/15/2013 02:17 PM, Daniel P. Berrange wrote: On Fri, Mar 15, 2013 at 02:10:08PM +0100, Martin Kletzander wrote: On 03/14/2013 06:15 PM, Daniel P. Berrange wrote: On Thu, Mar 14, 2013 at 10:27:32AM +0100, Martin Kletzander wrote: The vshInit initializes ctl-debug by which vshDebug (which is also called in vshParseArgv) decides whether to print out the message or not. Signed-off-by: Martin Kletzander mklet...@redhat.com --- [...] diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..58a604b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,12 +3100,12 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { +if (!vshParseArgv(ctl, argc, argv)) { vshDeinit(ctl); exit(EXIT_FAILURE); } ACK Thanks, pushed Martin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/4] Make vshDebug work when parsing parameters
The vshInit initializes ctl-debug by which vshDebug (which is also called in vshParseArgv) decides whether to print out the message or not. Signed-off-by: Martin Kletzander mklet...@redhat.com --- tools/virsh.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..9ed038a 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,15 +3100,13 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { -vshDeinit(ctl); +if (!vshParseArgv(ctl, argc, argv)) exit(EXIT_FAILURE); -} if (!ctl-imode) { ret = vshCommandRun(ctl, ctl-cmd); -- 1.8.1.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] Make vshDebug work when parsing parameters
On Thu, Mar 14, 2013 at 10:27:32AM +0100, Martin Kletzander wrote: The vshInit initializes ctl-debug by which vshDebug (which is also called in vshParseArgv) decides whether to print out the message or not. Signed-off-by: Martin Kletzander mklet...@redhat.com --- tools/virsh.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index d822e09..9ed038a 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3100,15 +3100,13 @@ main(int argc, char **argv) ctl-name = vshStrdup(ctl, defaultConn); } -if (!vshParseArgv(ctl, argc, argv)) { +if (!vshInit(ctl)) { vshDeinit(ctl); Hmm, we previously called vshDeinit() even though we'd not got to vshInit yet ! exit(EXIT_FAILURE); } -if (!vshInit(ctl)) { -vshDeinit(ctl); +if (!vshParseArgv(ctl, argc, argv)) But here you've lost the vshDeinit now. I think we need to put that back to keep valgrind happy, don't we ? Or is there some reason which forced to you drop the vshDeinit here ? exit(EXIT_FAILURE); -} Regards Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list