X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/376091144df4991f161f068f2c297b80e94d36db..00612a8c55aab3560966533fe77e4940f902b3b6:/apt-inst/dirstream.cc?ds=sidebyside

diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc
index 898ede31b..65d1aa188 100644
--- a/apt-inst/dirstream.cc
+++ b/apt-inst/dirstream.cc
@@ -11,9 +11,7 @@
    ##################################################################### */
 									/*}}}*/
 // Include Files							/*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/dirstream.h"
-#endif
+#include<config.h>
 
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/error.h>
@@ -47,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;
       }