[xml] Couldn't confirm bug 141146 - xmlwriter fails to signal write errors to the caller



Hi Tommi:

I'm playing around about the bug you issued but was not
able to confirm it.
When calling xmlNewTextWriterFilename() it fails on an 
completely filled partition (due xmlFileOpenW() callback).

Can you provide me more accurate info regarding this issue?

I'm providing a little patch for you please to test, Tommi.
It's just a guess.

Daniel, please do not apply it. 

regards
Lucas Brasilino

--- xmlwriter.c.orig    2004-05-15 22:09:53.000000000 -0300
+++ xmlwriter.c 2004-05-15 22:16:25.000000000 -0300
@@ -386,15 +386,19 @@
  * @writer:  the xmlTextWriterPtr
  *
  * Deallocate all the resources associated to the writer
+ *
+ * Returns -1 in case of error or 0.
  */
-void
+int
 xmlFreeTextWriter(xmlTextWriterPtr writer)
 {
+  int ret;
+
     if (writer == NULL)
-        return;
+        return -1;
 
     if (writer->out != NULL)
-        xmlOutputBufferClose(writer->out);
+        ret = xmlOutputBufferClose(writer->out);
 
     if (writer->nodes != NULL)
         xmlListDelete(writer->nodes);
@@ -408,6 +412,8 @@
     if (writer->ichar != NULL)
         xmlFree(writer->ichar);
     xmlFree(writer);
+
+    return (ret < 0) ? -1 : 0;
 }
 
 /**
--- include/libxml/xmlwriter.h.orig     2004-05-15 22:11:02.000000000 -0300
+++ include/libxml/xmlwriter.h  2004-05-15 22:17:16.000000000 -0300
@@ -39,7 +39,7 @@
     XMLPUBFUN xmlTextWriterPtr XMLCALL
         xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
                              int compression);
-    XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
+    XMLPUBFUN int XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
 
 /*
  * Functions




______________________________
EMPREL, http://www.recife.pe.gov.br

Attachment: xmlwriter-#131146.patch
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]