Kaynağa Gözat

for these helpers we don't need too much checks,
but no warnings from gcc helps

David Kalnischkies 14 yıl önce
ebeveyn
işleme
fca9751603

+ 1 - 2
test/interactive-helper/extract-control.cc

@@ -21,8 +21,7 @@ bool ExtractMember(const char *File,const char *Member)
    if (Extract.Control == 0)
       return true;
    
-   write(STDOUT_FILENO,Extract.Control,Extract.Length);
-   return true;
+   return write(STDOUT_FILENO,Extract.Control,Extract.Length) != -1;
 }
 
 int main(int argc, const char *argv[])

+ 2 - 1
test/interactive-helper/testextract.cc

@@ -66,7 +66,8 @@ bool Go(int argc,char *argv[])
 	 while (feof(F) == 0)
 	 {
 	    char Line[300];
-	    fgets(Line,sizeof(Line),F);
+	    if (fgets(Line,sizeof(Line),F) == NULL)
+	       return false;
 	    Itm.Name = _strstrip(Line);
 	    Itm.Type = pkgDirStream::Item::File;
 	    if (Line[strlen(Line)-1] == '/')