]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cgroup: Replace sscanf with virStrToLong_ll
authorMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 30 Mar 2010 14:20:41 +0000 (16:20 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 1 Apr 2010 10:53:41 +0000 (12:53 +0200)
The switch from %lli to %lld in virCgroupGetValueI64 is intended,
as virCgroupGetValueU64 uses base 10 too, and virCgroupSetValueI64
uses %lld to format the number to string.

Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.

src/util/cgroup.c

index 496d9d308b03a188ba918097db5c4923df8c2364..4cb09b6d7495eb3b7999e920da61cc047d1df98b 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <stdio.h>
 #include <stdint.h>
-#include <inttypes.h>
 #ifdef HAVE_MNTENT_H
 # include <mntent.h>
 #endif
@@ -374,7 +373,7 @@ static int virCgroupGetValueI64(virCgroupPtr group,
     if (rc != 0)
         goto out;
 
-    if (sscanf(strval, "%" SCNi64, value) != 1)
+    if (virStrToLong_ll(strval, NULL, 10, value) < 0)
         rc = -EINVAL;
 out:
     VIR_FREE(strval);