
On Tue, Mar 31, 2009 at 11:35:23PM +0200, Daniel Veillard wrote:
On Tue, Mar 31, 2009 at 02:58:37PM +0100, Daniel P. Berrange wrote:
On Tue, Mar 31, 2009 at 12:09:21PM +0200, Daniel Veillard wrote:
+#define MAX_INDENT 100 + +static void +cmdNodeListDevicesPrint(vshControl *ctl, + char **devices, + char **parents, + int num_devices, + int devid, + int lastdev, + unsigned int depth, + char *indent) +{ + int i; + int nextlastdev = -1;
Before even modifying indent[depth] here I would check that depth + 2 < MAX_INDENT and abort on an error here,
Actually we have a 4 level indent here. This is all getting rather confusing, so I've separated the depth we've descended from the indentation used, and defined the buffer to be a multiple of max depth.
Also fixed a minor leak in the virNodeDeviceGetParent() impl of the remote driver. In the wonderful world of XDR, we have to free the char**, but not the char *.
Okidoc, ACK !
Great, committed this Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|