]> git.saurik.com Git - apt.git/blobdiff - apt-inst/dirstream.cc
add a simple webserver for our testcases
[apt.git] / apt-inst / dirstream.cc
index 586bbf739d71572f667ae73c867c8492416e9741..65d1aa188a6b3080fa7e8c3177d53ff0e6c124ba 100644 (file)
@@ -11,6 +11,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/error.h>
 
@@ -43,11 +45,15 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd)
         
         // fchmod deals with umask and fchown sets the ownership
         if (fchmod(iFd,Itm.Mode) != 0)
-           return _error->Errno("fchmod",_("Failed to write file %s"),
-                                Itm.Name);
+        {
+           close(iFd);
+           return _error->Errno("fchmod",_("Failed to write file %s"), Itm.Name);
+        }
         if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM)
-           return _error->Errno("fchown",_("Failed to write file %s"),
-                                Itm.Name);
+        {
+           close(iFd);
+           return _error->Errno("fchown",_("Failed to write file %s"), Itm.Name);
+        }
         Fd = iFd;
         return true;
       }