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.
This commit is contained in:
Matthias Bolte 2010-03-30 16:20:41 +02:00
parent 56bac4a221
commit 73b45bfbff

View File

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