components/libxslt/patches/10-libxslt-xsltproc-should-return-an-error-code-if-xinclude-fails.patch
branchs11u1-sru
changeset 2471 b1f0e4a84df6
equal deleted inserted replaced
2469:0b02cc321ac6 2471:b1f0e4a84df6
       
     1 Taken as it's from:
       
     2 
       
     3 http://git.gnome.org/browse/libxslt/commit/?id=e669a8c7cefec93ee1bfaf59721aadc42e226d6e
       
     4 
       
     5 From e669a8c7cefec93ee1bfaf59721aadc42e226d6e Mon Sep 17 00:00:00 2001
       
     6 From: Malcolm Purvis <[email protected]>
       
     7 Date: Thu, 16 Aug 2012 09:08:31 +0000
       
     8 Subject: xsltproc should return an error code if xinclude fails
       
     9 
       
    10 When running xsltproc with the --xinclude option and if the included file
       
    11 contains parse errors, then xsltproc exits with a success return code (0)
       
    12 rather than an error code.  This is despite the fact that parser error
       
    13 messages are printed out.
       
    14 * xsltproc/xsltproc.c: check xinclude processing function return code,
       
    15   fail with error 6 if it went wrong.
       
    16 ---
       
    17 diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c
       
    18 index 8244ef3..42d6b9a 100644
       
    19 --- a/xsltproc/xsltproc.c
       
    20 +++ b/xsltproc/xsltproc.c
       
    21 @@ -359,16 +359,23 @@ xsltProcess(xmlDocPtr doc, xsltStylesheetPtr cur, const char *filename) {
       
    22  
       
    23  #ifdef LIBXML_XINCLUDE_ENABLED
       
    24      if (xinclude) {
       
    25 +        int ret;
       
    26 +
       
    27  	if (timing)
       
    28  	    startTimer();
       
    29  #if LIBXML_VERSION >= 20603
       
    30 -	xmlXIncludeProcessFlags(doc, XSLT_PARSE_OPTIONS);
       
    31 +	ret = xmlXIncludeProcessFlags(doc, XSLT_PARSE_OPTIONS);
       
    32  #else
       
    33 -	xmlXIncludeProcess(doc);
       
    34 +	ret = xmlXIncludeProcess(doc);
       
    35  #endif
       
    36  	if (timing) {
       
    37  	    endTimer("XInclude processing %s", filename);
       
    38  	}
       
    39 +
       
    40 +        if (ret < 0) {
       
    41 +	    errorno = 6;
       
    42 +            return;
       
    43 +        }
       
    44      }
       
    45  #endif
       
    46      if (timing)
       
    47 --
       
    48 cgit v0.9.0.2