summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2015-08-05 16:36:06 +0530
committerRajesh Joseph <rjoseph@redhat.com>2015-08-18 00:00:16 -0700
commitcc0ba2ad47aa9d023f823cced9047a2287a990b4 (patch)
treec1be05d10cd2bc9a1834a30bbdf8c6c4f854bdaf /cli
parenta40f9b42390d1143c2bf6dc710414c11ceb6cc22 (diff)
xml output: Fix non-uniform opErrstr xml output
Backport of http://review.gluster.org/#/c/11835/ Display <opErrstr/> in case of no operrstr for all xml output of gluster commands. Change-Id: Ie16f749f90b4642357c562012408c434cd38661f BUG: 1253607 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/11920 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
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: