]> git.saurik.com Git - apt.git/blobdiff - test/interactive-helper/extract-control.cc
try to avoid removal of crossgraded packages
[apt.git] / test / interactive-helper / extract-control.cc
index 29dcbf371bdaf68663dcfb753f0815269bc2fd15..852ec4ee98ecdb4acbf25bcac6051b678971ff29 100644 (file)
@@ -1,12 +1,16 @@
+#include <config.h>
+
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
 
+#include <string>
 #include <iostream>
 #include <unistd.h>
 
 using namespace std;
 
-bool ExtractMember(const char *File,const char *Member)
+static bool ExtractMember(const char *File,const char *Member)
 {
    FileFd Fd(File,FileFd::ReadOnly);
    debDebFile Deb(Fd);
@@ -20,8 +24,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[])