summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2010-07-09 21:54:02 +0200
committerMichael Vogt <mvo@debian.org>2010-07-09 21:54:02 +0200
commit68f3081559998a0b2b1ddcaf80a8cf0e46658483 (patch)
treebb53b6c174fbf850f0e9b9ee303de9130b49739d /apt-pkg/contrib/fileutl.cc
parent5d062ce08e6125d9ef34d3e55d4a88c1937f4f21 (diff)
parent62d073d937742baf8621a11c3094e0320aa846cd (diff)
* doc/apt.conf.5.xml:
- add and document APT::Cache-{Start,Grow,Limit} options for mmap control
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 62d42e4da..8f7791a8a 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -843,19 +843,21 @@ bool FileFd::Close()
bool Res = true;
if ((Flags & AutoClose) == AutoClose)
if (iFd >= 0 && close(iFd) != 0)
- Res &= _error->Errno("close",_("Problem closing the file"));
- iFd = -1;
+ Res &= _error->Errno("close",_("Problem closing the file %s"), FileName.c_str());
- if ((Flags & Replace) == Replace) {
+ if ((Flags & Replace) == Replace && iFd >= 0) {
if (rename(TemporaryFileName.c_str(), FileName.c_str()) != 0)
- Res &= _error->Errno("rename",_("Problem renaming the file"));
+ Res &= _error->Errno("rename",_("Problem renaming the file %s to %s"), TemporaryFileName.c_str(), FileName.c_str());
+
FileName = TemporaryFileName; // for the unlink() below.
}
-
+
+ iFd = -1;
+
if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail &&
FileName.empty() == false)
if (unlink(FileName.c_str()) != 0)
- Res &= _error->WarningE("unlnk",_("Problem unlinking the file"));
+ Res &= _error->WarningE("unlnk",_("Problem unlinking the file %s"), FileName.c_str());
return Res;