From: Tim Wiederhake Date: Wed, 21 Apr 2021 15:51:30 +0000 (+0200) Subject: virStorageEncryptionInfoParseCipher: Use virXMLProp* X-Git-Tag: v7.3.0-rc1~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad1d37876db0522167edd7e78e24b1b771605e02;p=thirdparty%2Flibvirt.git virStorageEncryptionInfoParseCipher: Use virXMLProp* Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c index c2c7c1dd43..9112b96cc7 100644 --- a/src/conf/storage_encryption_conf.c +++ b/src/conf/storage_encryption_conf.c @@ -176,27 +176,15 @@ static int virStorageEncryptionInfoParseCipher(xmlNodePtr info_node, virStorageEncryptionInfoDef *info) { - g_autofree char *size_str = NULL; - if (!(info->cipher_name = virXMLPropString(info_node, "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("cipher info missing 'name' attribute")); return -1; } - if ((size_str = virXMLPropString(info_node, "size")) && - virStrToLong_uip(size_str, NULL, 10, &info->cipher_size) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse cipher size: '%s'"), - size_str); - return -1; - } - - if (!size_str) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("cipher info missing 'size' attribute")); + if (virXMLPropUInt(info_node, "size", 10, VIR_XML_PROP_REQUIRED, + &info->cipher_size) < 0) return -1; - } info->cipher_mode = virXMLPropString(info_node, "mode"); info->cipher_hash = virXMLPropString(info_node, "hash");