summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-xml-output.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index d41aebc8cad..b558a9a843c 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -123,8 +123,15 @@ cli_xml_output_common (xmlTextWriterPtr writer, int op_ret, int op_errno,
"%d", op_errno);
XML_RET_CHECK_AND_GOTO (ret, out);
- ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"opErrstr",
- "%s", op_errstr);
+ if (op_errstr)
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"opErrstr",
+ "%s", op_errstr);
+ else
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"opErrstr",
+ "%s", "");
+
XML_RET_CHECK_AND_GOTO (ret, out);
out: