]> git.saurik.com Git - apt.git/blobdiff - apt-inst/dirstream.cc
merged from lp:~mvo/apt/mvo
[apt.git] / apt-inst / dirstream.cc
index 586bbf739d71572f667ae73c867c8492416e9741..9b6a568482a5206af9dc9a84b6a6dec305be9cd9 100644 (file)
@@ -43,11 +43,17 @@ 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);
+        {
+           _error->Errno("fchmod",_("Failed to write file %s"), Itm.Name);
+           close(iFd);
+           return false;
+        }
         if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM)
-           return _error->Errno("fchown",_("Failed to write file %s"),
-                                Itm.Name);
+        {
+           return _error->Errno("fchown",_("Failed to write file %s"), Itm.Name);
+           close(iFd);
+           return false;
+        }
         Fd = iFd;
         return true;
       }