for these helpers we don't need too much checks,
authorDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 20 Mar 2012 20:08:15 +0000 (21:08 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Tue, 20 Mar 2012 20:08:15 +0000 (21:08 +0100)
but no warnings from gcc helps

test/interactive-helper/extract-control.cc
test/interactive-helper/testextract.cc

index a1b3600..3f7feab 100644 (file)
@@ -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[])
index f7ddb72..8dfe68f 100644 (file)
@@ -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] == '/')