- xmlTextReaderRead() can fail with non-zero values as well
authorpmatilai <pmatilai>
Tue, 18 Apr 2006 20:10:11 +0000 (20:10 +0000)
committerpmatilai <pmatilai>
Tue, 18 Apr 2006 20:10:11 +0000 (20:10 +0000)
apt-pkg/rpm/rpmindexfile.cc

index 82185b4..9aaa72e 100644 (file)
@@ -704,12 +704,12 @@ unsigned long rpmRepomdIndex::Size() const
                          XML_PARSE_NONET|XML_PARSE_NOBLANKS);
    if (Index == NULL) return 0;
 
                          XML_PARSE_NONET|XML_PARSE_NOBLANKS);
    if (Index == NULL) return 0;
 
-   if (xmlTextReaderRead(Index) == 0) {
-      Res = 0;
-   } else {
+   if (xmlTextReaderRead(Index) == 1) {
       xmlChar *pkgs = xmlTextReaderGetAttribute(Index, (xmlChar*)"packages");
       Res = atoi((char*)pkgs);
       xmlFree(pkgs);
       xmlChar *pkgs = xmlTextReaderGetAttribute(Index, (xmlChar*)"packages");
       Res = atoi((char*)pkgs);
       xmlFree(pkgs);
+   } else {
+      Res = 0;
    }
    xmlFreeTextReader(Index);
    return Res;
    }
    xmlFreeTextReader(Index);
    return Res;