From 24fbb6adb071c39e24f9b0a89aadc7d5673a8775 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 19 Mar 2017 12:59:44 +0100 Subject: Avoid chdir in acquire clean with unlinkat POSIX.1-2008 gives us a range of *at calls to deal with files including the unlinkat so we can remove a file from a directory based on a path to the file relative to the directory. (In our case here the path we have is just the filename) We avoid changing directories in this way which e.g. fails if the directory we started in no longer exists or is otherwise inaccessible. Closes: 860738 --- apt-pkg/contrib/fileutl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/contrib/fileutl.h') diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index dddeb70f5..b3804cccc 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -161,6 +161,7 @@ class FileFd bool RunScripts(const char *Cnf); bool CopyFile(FileFd &From,FileFd &To); bool RemoveFile(char const * const Function, std::string const &FileName); +bool RemoveFileAt(char const * const Function, int const dirfd, std::string const &FileName); int GetLock(std::string File,bool Errors = true); bool FileExists(std::string File); bool RealFileExists(std::string File); -- cgit v1.2.3