Just a couple of small cosmetic improvements. Signed-off-by: Andrea Bolognani <abolo...@redhat.com> Reviewed-by: Bjoern Walk <bw...@linux.vnet.ibm.com> --- src/util/virhostcpu.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index 3091a92c0..2259c9f2f 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -518,16 +518,19 @@ virHostCPUParseFrequencyString(const char *str, while (*str && c_isspace(*str)) str++; - if (*str != ':' || !str[1]) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); + if (str[0] != ':' || !str[1]) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing or invalid CPU frequency in %s"), + CPUINFO_PATH); return -1; } + /* Accept an unsigned value, optionally followed by + * a fractional part (which gets discarded) */ if (virStrToLong_ui(str + 1, &p, 10, &ui) == 0 && - /* Accept trailing fractional part. */ - (*p == '\0' || *p == '.' || c_isspace(*p))) + (*p == '\0' || *p == '.' || c_isspace(*p))) { *mhz = ui; + } return 0; } -- 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list