On 04/19/2012 06:33 PM, Laine Stump wrote: > On 04/19/2012 02:24 PM, Eric Blake wrote: >> https://bugzilla.redhat.com/show_bug.cgi?id=617711 reported that >> even with my recent patched to allow <memory unit='G'>1</memory>, >> people can still get away with trying <memory>1G</memory> and >> silently get <memory unit='KiB'>1</memory> instead. While >> virt-xml-validate catches the error, our C parser did not. >> >> Not to mention that it's always fun to fix bugs while reducing >> lines of code. :) >> >> - char *end = NULL; >> - perms->mode = strtol(mode, &end, 8); >> - if (*end || (perms->mode & ~0777)) { >> + int tmp; >> + >> + if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) { >> VIR_FREE(mode); >> virStorageReportError(VIR_ERR_XML_ERROR, >> "%s", _("malformed octal mode")); >> goto error; >> } >> + perms->mode = tmp; > > > I'm curious why in the case of clock.data.variable.adjustment, you > switched it to do the conversion directly into the object attribute, > while in this case you switched it in the opposite direction. virStrToLong_i() requires an int, but we are not guaranteed that mode_t is an int, so I had to go through a temporary here. > ACK, in any case. Thanks for the reviews. I've pushed the series. -- 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