mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
util: json: Report non-OOM error on yajl failure
The yajl library returns a wide range of error codes so reporting OOM on any failure is wrong. In case the error was really based by memory issue the error reporting will probably cause an abort anyways. Change the error message so that we know that it happened in JSON at least. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
e09c852782
commit
0af84a81fc
@ -1943,12 +1943,14 @@ virJSONValueToBuffer(virJSONValuePtr object,
|
||||
yajl_gen_config(g, yajl_gen_validate_utf8, 1);
|
||||
|
||||
if (virJSONValueToStringOne(object, g) < 0) {
|
||||
virReportOOMError();
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to convert virJSONValue to yajl data"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (yajl_gen_get_buf(g, &str, &len) != yajl_gen_status_ok) {
|
||||
virReportOOMError();
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to format JSON"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user