Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > d41e7febba7533a5711c18660c676cc9 > files > 20

libxslt-1.1.17-4.el5_8.3.src.rpm

From 1a0a17232e8eb63d74f8cc84fa541237c41e1226 Mon Sep 17 00:00:00 2001
From: Malcolm Purvis <malcolm@purvis.id.au>
Date: Thu, 16 Aug 2012 17:08:31 +0800
Subject: [PATCH] xsltproc should return an error code if xinclude fails
To: libvir-list@redhat.com

When running xsltproc with the --xinclude option and if the included file
contains parse errors, then xsltproc exits with a success return code (0)
rather than an error code.  This is despite the fact that parser error
messages are printed out.
* xsltproc/xsltproc.c: check xinclude processing function return code,
  fail with error 6 if it went wrong.

Signed-off-by: Daniel Veillard <veillard@redhat.com>
---
 xsltproc/xsltproc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c
index 2d8a9f4..4fd5952 100644
--- a/xsltproc/xsltproc.c
+++ b/xsltproc/xsltproc.c
@@ -357,16 +357,23 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) {
 
 #ifdef LIBXML_XINCLUDE_ENABLED
     if (xinclude) {
+        int ret;
+
 	if (timing)
 	    startTimer();
 #if LIBXML_VERSION >= 20603
-	xmlXIncludeProcessFlags(doc, XSLT_PARSE_OPTIONS);
+	ret = xmlXIncludeProcessFlags(doc, XSLT_PARSE_OPTIONS);
 #else
-	xmlXIncludeProcess(doc);
+	ret = xmlXIncludeProcess(doc);
 #endif
 	if (timing) {
 	    endTimer("XInclude processing %s", filename);
 	}
+
+        if (ret < 0) {
+	    errorno = 6;
+            return;
+        }
     }
 #endif
     if (timing)
-- 
1.7.11.4