[Libvir] [PATCH] Parse integers more carefully, cont'd.

Jim Meyering jim at meyering.net
Mon Nov 12 22:10:25 UTC 2007


Here's part two in the strtol fix-up series:

Parse integers more carefully, cont'd.
* qemud/qemud.c: Replace uses of strtol with uses of xstrtol_i.
  Avoid overflow for very large --timeout=N values.
* src/nodeinfo.c: In linuxNodeInfoMemPopulate and
  linuxNodeInfoCPUPopulate, use xstrtol_i rather than strtol.
  Unlike in qemud.c, here we allow trailing "isspace", and in
  the case of "cpuinfo cpu MHz", also allow a "." terminator,
  since we ignore the decimal and any following digits.
* src/internal.h: Define xstrtol_iu, too.

Signed-off-by: Jim Meyering <meyering at redhat.com>
---
 qemud/qemud.c  |   16 ++++++----------
 src/internal.h |   19 +++++++++++++++++++
 src/nodeinfo.c |   24 +++++++++++++++++++-----
 3 files changed, 44 insertions(+), 15 deletions(-)

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: strtol-p2
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071112/66856e39/attachment-0001.ksh>


More information about the libvir-list mailing list