On Fri, Jun 16, 2017 at 05:29:42PM +0200, Peter Krempa wrote:
Merge the reporting of the missing source host data into the parser
functions so that callers don't have to do it separately.
---
src/util/virstoragefile.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index c7632808e..c0aa4e4c6 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
[...]
@@ -2839,14 +2858,13 @@
virStorageSourceParseBackingJSONSocketAddress(virStorageNetHostDefPtr host,
return virStorageSourceParseBackingJSONInetSocketAddress(host, json);
case VIR_STORAGE_NET_HOST_TRANS_UNIX:
- if (!socket) {
+ if (!(socket = virJSONValueObjectGetString(json, "socket"))) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("missing socket path for udp backing server in "
"JSON backing volume definition"));
return -1;
}
-
Spurious line removal :)
if (VIR_STRDUP(host->socket, socket) < 0)
return -1;
Reviewed-by: Pavel Hrdina <phrdina(a)redhat.com>