diff --git a/src/util/virsexpr.c b/src/util/virsexpr.c index f5eb364e40b436981590cb5ec72be7be624689b0..f8a0ccdb433805e32e565b483f88aa51f0030899 100644 --- a/src/util/virsexpr.c +++ b/src/util/virsexpr.c @@ -567,7 +567,7 @@ sexpr_int(const struct sexpr *sexpr, const char *name) if (value) { int val = 0; - virStrToLong_i(value, NULL, 0, &val); + ignore_value(virStrToLong_i(value, NULL, 0, &val)); return val; } return 0; @@ -590,7 +590,7 @@ sexpr_float(const struct sexpr *sexpr, const char *name) if (value) { double val = 0; - virStrToDouble(value, NULL, &val); + ignore_value(virStrToDouble(value, NULL, &val)); return val; } return 0; @@ -613,7 +613,7 @@ sexpr_u64(const struct sexpr *sexpr, const char *name) if (value) { unsigned long long val = 0; - virStrToLong_ull(value, NULL, 0, &val); + ignore_value(virStrToLong_ull(value, NULL, 0, &val)); return val; } return 0; diff --git a/src/util/virstring.h b/src/util/virstring.h index df254417bedbfda07d3b6008a88e81774c955e7d..267fbd05e3ffbbee993ab614d8078a0af929c882 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -51,43 +51,53 @@ char *virArgvToString(const char *const *argv); int virStrToLong_i(char const *s, char **end_ptr, int base, - int *result); + int *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_ui(char const *s, char **end_ptr, int base, - unsigned int *result); + unsigned int *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_uip(char const *s, char **end_ptr, int base, - unsigned int *result); + unsigned int *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_l(char const *s, char **end_ptr, int base, - long *result); + long *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_ul(char const *s, char **end_ptr, int base, - unsigned long *result); + unsigned long *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_ulp(char const *s, char **end_ptr, int base, - unsigned long *result); + unsigned long *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_ll(char const *s, char **end_ptr, int base, - long long *result); + long long *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_ull(char const *s, char **end_ptr, int base, - unsigned long long *result); + unsigned long long *result) + ATTRIBUTE_RETURN_CHECK; int virStrToLong_ullp(char const *s, char **end_ptr, int base, - unsigned long long *result); + unsigned long long *result) + ATTRIBUTE_RETURN_CHECK; int virStrToDouble(char const *s, char **end_ptr, - double *result); + double *result) + ATTRIBUTE_RETURN_CHECK; void virSkipSpaces(const char **str) ATTRIBUTE_NONNULL(1); void virSkipSpacesAndBackslash(const char **str) ATTRIBUTE_NONNULL(1); diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index e60a6726895030a7a1629c00ded486bbda82b0b3..a18d7aba9555fdea24cea2570a2cb250409885f3 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -2344,8 +2344,8 @@ static void vboxHostDeviceGetXMLDesc(vboxGlobalData *data, virDomainDefPtr def, VBOX_UTF16_TO_UTF8(vendorIdUtf16, &vendorIdUtf8); VBOX_UTF16_TO_UTF8(productIdUtf16, &productIdUtf8); - virStrToLong_ui(vendorIdUtf8, &endptr, 16, &vendorId); - virStrToLong_ui(productIdUtf8, &endptr, 16, &productId); + ignore_value(virStrToLong_ui(vendorIdUtf8, &endptr, 16, &vendorId)); + ignore_value(virStrToLong_ui(productIdUtf8, &endptr, 16, &productId)); def->hostdevs[USBFilterCount]->source.subsys.u.usb.vendor = vendorId; def->hostdevs[USBFilterCount]->source.subsys.u.usb.product = productId; diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 8ddcd7ebb88e1a5c85230974b9e0e5666598e28d..7e2d477c1eba413245fdede2e4307a1164cc6b5e 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -335,7 +335,7 @@ xenStoreDomainGetVNCPort(virConnectPtr conn, int domid) tmp = virDomainDoStoreQuery(conn, domid, "console/vnc-port"); if (tmp != NULL) { - virStrToLong_i(tmp, NULL, 10, &ret); + ignore_value(virStrToLong_i(tmp, NULL, 10, &ret)); VIR_FREE(tmp); } return ret; diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 7eb183ee564ee915b3477b3038441fb0393941cd..f6492b51792f89256fbcb6cbcfee1ed5270b0dea 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -1026,8 +1026,13 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (VIR_STRDUP(graphics->data.vnc.keymap, key + 7) < 0) goto cleanup; } else if (STRPREFIX(key, "vncdisplay=")) { - virStrToLong_i(key + 11, NULL, 10, - &graphics->data.vnc.port); + if (virStrToLong_i(key + 11, NULL, 10, + &graphics->data.vnc.port) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid vncdisplay value '%s'"), + key + 11); + goto cleanup; + } graphics->data.vnc.port += 5900; } } else {