FIX:core: ezxml doesn't close negative fds when parsing file, provide a workaround
authorzaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 6 Nov 2008 12:04:54 +0000 (12:04 +0000)
committerzaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 6 Nov 2008 12:04:54 +0000 (12:04 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1652 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/xmlconfig.c

index bedfc42..f153a08 100644 (file)
@@ -796,8 +796,14 @@ parse_node(struct xmldocument *document, ezxml_t node)
 static gboolean
 parse_file(struct xmldocument *document, xmlerror **error)
 {
-       ezxml_t root = ezxml_parse_file(document->href);
-
+       int fd;
+       ezxml_t root;
+       /* BUG workaround: ezxml parse file leaves negative fds unclosed */
+       fd = open(document->href, O_RDONLY, 0);
+       if (fd == -1)
+               return FALSE;
+       root = ezxml_parse_fd(fd);
+       close(fd);
        if (!root)
                return FALSE;
        document->active=document->xpointer ? 0:1;