summaryrefslogtreecommitdiff
path: root/apt-inst/dirstream.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-04-16 01:10:09 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-04-16 01:10:09 +0200
commit6070a3461841d4398d731fcb33792d55779111f1 (patch)
tree2b7217a5d542202040e8abdcf2eb5d52a32efd90 /apt-inst/dirstream.cc
parent949e033cb7c741b9eed459c0e93a89a92acb168d (diff)
fix a bunch of cppcheck warnings/errors based on a patch by
Niels Thykier, thanks! (Closes: #622805)
Diffstat (limited to 'apt-inst/dirstream.cc')
-rw-r--r--apt-inst/dirstream.cc14
1 files changed, 10 insertions, 4 deletions
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;
}