On 03/31/2010 03:41 PM, Matthias Bolte wrote:
Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.
The other instances are okay, but...
@@ -1659,7 +1659,7 @@ virNWFilterRuleParse(virConnectPtr conn,
ret->priority = MAX_RULE_PRIORITY / 2;
if (prio) {
- if (sscanf(prio, "%d", (int *)&priority) == 1) {
+ if (virStrToLong_i(prio, NULL, 10, (int *)&priority) >= 0) {
if ((int)priority >= 0 && priority <= MAX_RULE_PRIORITY)
This looks gross. Since priority is unsigned int, why not just use:
virStrToLong_ui(,,,&priority) >= 0
if (priority <= MAX_RULE_PRIORITY)
ACK if you make that tweak.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org