From: Matthias Bolte Date: Tue, 30 Mar 2010 14:20:41 +0000 (+0200) Subject: cgroup: Replace sscanf with virStrToLong_ll X-Git-Tag: v0.8.0~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73b45bfbffa25e196c6095692a4619404a583ec8;p=thirdparty%2Flibvirt.git 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. --- 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);