diff options
Diffstat (limited to 'ftparchive')
-rw-r--r-- | ftparchive/byhash.cc | 5 | ||||
-rw-r--r-- | ftparchive/multicompress.cc | 4 | ||||
-rw-r--r-- | ftparchive/writer.cc | 4 |
3 files changed, 4 insertions, 9 deletions
diff --git a/ftparchive/byhash.cc b/ftparchive/byhash.cc index 0a38457c0..354d089c3 100644 --- a/ftparchive/byhash.cc +++ b/ftparchive/byhash.cc @@ -41,9 +41,8 @@ void DeleteAllButMostRecent(std::string dir, int KeepFiles) auto files = GetListOfFilesInDir(dir, false); std::sort(files.begin(), files.end(), Cmp()); - for (auto I=files.begin(); I<files.end()-KeepFiles; I++) { - unlink((*I).c_str()); - } + for (auto I=files.begin(); I<files.end()-KeepFiles; ++I) + RemoveFile("DeleteAllButMostRecent", *I); } // Takes a input filename (e.g. binary-i386/Packages) and a hashstring diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index 08a3cff5a..3ffc5266e 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -352,9 +352,7 @@ bool MultiCompress::Child(int const &FD) for (Files *I = Outputs; I != 0; I = I->Next) { I->TmpFile.Close(); - if (unlink(I->TmpFile.Name().c_str()) != 0) - _error->Errno("unlink",_("Problem unlinking %s"), - I->TmpFile.Name().c_str()); + RemoveFile("MultiCompress::Child", I->TmpFile.Name()); } return !_error->PendingError(); } diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 0bd2be566..c0223a74c 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -302,9 +302,7 @@ bool FTWScanner::Delink(string &FileName,const char *OriginalPath, _error->Errno("readlink",_("Failed to readlink %s"),OriginalPath); else { - if (unlink(OriginalPath) != 0) - _error->Errno("unlink",_("Failed to unlink %s"),OriginalPath); - else + if (RemoveFile("FTWScanner::Delink", OriginalPath)) { if (link(FileName.c_str(),OriginalPath) != 0) { |