On 02/16/2012 01:55 PM, Stefan Berger wrote: > Improve the logging during nwfilter driver initialization when testing the > command line tools. > > --- > src/nwfilter/nwfilter_ebiptables_driver.c | 41 > +++++++++++++++++++++--------- > 1 file changed, 29 insertions(+), 12 deletions(-) > > @@ -4056,8 +4057,14 @@ ebiptablesDriverInit(bool privileged) > "%s", > CMD_STOPONERR(1)); > > - if (ebiptablesExecCLI(&buf, NULL, NULL) < 0) > - VIR_FREE(ebtables_cmd_path); > + if (ebiptablesExecCLI(&buf, NULL, &errmsg) < 0) { > + VIR_FREE(ebtables_cmd_path); > + VIR_ERROR(_("Testing of ebtables command failed%s%s."), I'd drop the trailing '.' here and the other two instances (you have no idea if errmsg already has its own trailing '.'. And while we are not a GNU project, the GNU Coding Standards recommend error messages that do not end in a period) > + errmsg ? ": " : "", > + errmsg ? errmsg : ""); > + } > + } else { > + VIR_WARN(_("Could not find 'ebtables' executable.")); > } > > iptables_cmd_path = virFindFileInPath("iptables"); > @@ -4070,8 +4077,14 @@ ebiptablesDriverInit(bool privileged) > "%s", > CMD_STOPONERR(1)); > > - if (ebiptablesExecCLI(&buf, NULL, NULL) < 0) > - VIR_FREE(iptables_cmd_path); > + if (ebiptablesExecCLI(&buf, NULL, &errmsg) < 0) { I had to check ebiptablesExecCLI to make sure you didn't have a memory leak if two back-to-back calls both populate errmsg (thankfully, you are safe). ACK with the '.' nits fixed. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list