From 73b45bfbffa25e196c6095692a4619404a583ec8 Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Tue, 30 Mar 2010 16:20:41 +0200 Subject: [PATCH] cgroup: Replace sscanf with virStrToLong_ll 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 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util/cgroup.c b/src/util/cgroup.c index 496d9d308b..4cb09b6d74 100644 --- a/src/util/cgroup.c +++ b/src/util/cgroup.c @@ -12,7 +12,6 @@ #include #include -#include #ifdef HAVE_MNTENT_H # include #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);