xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-Do-not-print-error-context-when-there-is-none.patch

267d54
From c5031779667ff362d670e34a42e9bc4f5a430793 Mon Sep 17 00:00:00 2001
267d54
From: Daniel Veillard <veillard@redhat.com>
267d54
Date: Fri, 20 Nov 2015 15:01:22 +0800
267d54
Subject: [PATCH] Do not print error context when there is none
267d54
To: libvir-list@redhat.com
267d54
267d54
Which now happens more frequently du to xmlHaltParser use
267d54
267d54
Signed-off-by: Daniel Veillard <veillard@redhat.com>
267d54
---
267d54
 error.c | 4 +++-
267d54
 1 file changed, 3 insertions(+), 1 deletion(-)
267d54
267d54
diff --git a/error.c b/error.c
267d54
index cbcf5c9..9c45040 100644
267d54
--- a/error.c
267d54
+++ b/error.c
267d54
@@ -177,7 +177,9 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
267d54
     xmlChar  content[81]; /* space for 80 chars + line terminator */
267d54
     xmlChar *ctnt;
267d54
 
267d54
-    if (input == NULL) return;
267d54
+    if ((input == NULL) || (input->cur == NULL) ||
267d54
+        (*input->cur == 0)) return;
267d54
+
267d54
     cur = input->cur;
267d54
     base = input->base;
267d54
     /* skip backwards over any end-of-lines */
267d54
-- 
267d54
2.5.0
267d54