X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/20a8adb3d45a4419cd8c1de5e63f4b10ca190a3f..6070a3461841d4398d731fcb33792d55779111f1:/apt-inst/dirstream.cc diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc index 898ede31b..9b6a56848 100644 --- a/apt-inst/dirstream.cc +++ b/apt-inst/dirstream.cc @@ -11,10 +11,6 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/dirstream.h" -#endif - #include #include @@ -47,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; }