diff options
Diffstat (limited to 'apt-inst')
-rw-r--r-- | apt-inst/contrib/extracttar.cc | 2 | ||||
-rw-r--r-- | apt-inst/dirstream.cc | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc index 1a358d57e..01b6b3836 100644 --- a/apt-inst/contrib/extracttar.cc +++ b/apt-inst/contrib/extracttar.cc @@ -336,7 +336,7 @@ bool ExtractTar::Go(pkgDirStream &Stream) } // And finish up - if (Itm.Size >= 0 && BadRecord == false) + if (BadRecord == false) if (Stream.FinishedFile(Itm,Fd) == false) return false; diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc index 586bbf739..9b6a56848 100644 --- a/apt-inst/dirstream.cc +++ b/apt-inst/dirstream.cc @@ -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; } |