[Libvir] [PATCH] Check calls to printf-like functions (and some fixes) (second version)

-- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 "[Negative numbers] darken the very whole doctrines of the equations and make dark of the things which are in their nature excessively obvious and simple" (Francis Maseres FRS, mathematician, 1759)

On Fri, Mar 16, 2007 at 02:23:08PM +0000, Richard W.M. Jones wrote:
Okay, applied and commited, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Any opinions on what this code was supposed to be doing? I fixed it in the patch (now in CVS) by commenting out the extra boot_dev parameters - wasn't sure if they should be deleted altogether. @@ -418,11 +418,11 @@ if (boot_dev) { if (xmlStrEqual(boot_dev, BAD_CAST "fd")) { - virBufferVSprintf(buf, "(boot a)", (const char *) boot_dev); + virBufferVSprintf(buf, "(boot a)" /*, (const char *) boot_dev*/); } else if (xmlStrEqual(boot_dev, BAD_CAST "cdrom")) { - virBufferVSprintf(buf, "(boot d)", (const char *) boot_dev); + virBufferVSprintf(buf, "(boot d)" /*, (const char *) boot_dev*/); } else if (xmlStrEqual(boot_dev, BAD_CAST "hd")) { - virBufferVSprintf(buf, "(boot c)", (const char *) boot_dev); + virBufferVSprintf(buf, "(boot c)" /*, (const char *) boot_dev*/); } else { /* Any other type of boot dev is unsupported right now */ virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0); Rich. -- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 "[Negative numbers] darken the very whole doctrines of the equations and make dark of the things which are in their nature excessively obvious and simple" (Francis Maseres FRS, mathematician, 1759)

if (boot_dev) { if (xmlStrEqual(boot_dev, BAD_CAST "fd")) { - virBufferVSprintf(buf, "(boot a)", (const char *) boot_dev); + virBufferVSprintf(buf, "(boot a)" /*, (const char *) boot_dev*/); } else if (xmlStrEqual(boot_dev, BAD_CAST "cdrom")) { - virBufferVSprintf(buf, "(boot d)", (const char *) boot_dev); + virBufferVSprintf(buf, "(boot d)" /*, (const char *) boot_dev*/); } else if (xmlStrEqual(boot_dev, BAD_CAST "hd")) { - virBufferVSprintf(buf, "(boot c)", (const char *) boot_dev); + virBufferVSprintf(buf, "(boot c)" /*, (const char *) boot_dev*/);
This looks like rather dubios legacy code - kill the last arg completely rather than commenting it out. The rest looks fine to me. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

Daniel P. Berrange wrote:
This looks like rather dubios legacy code - kill the last arg completely rather than commenting it out.
Attached - a ridiculously small patch to kill the extra param! Rich. -- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 "[Negative numbers] darken the very whole doctrines of the equations and make dark of the things which are in their nature excessively obvious and simple" (Francis Maseres FRS, mathematician, 1759)
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Richard W.M. Jones