mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-01 03:33:42 +00:00
Add a note about how the "isFile" check in Path::eraseFromDisk prevents
the erasure of non-file paths like /dev/null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e8501eb1bb
commit
bffdc36c38
@ -569,6 +569,11 @@ Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
|
||||
if (getFileStatus(Status, ErrStr))
|
||||
return true;
|
||||
|
||||
// Note: this check catches strange situations. In all cases, LLVM should only
|
||||
// be involved in the creation and deletion of regular files. This check
|
||||
// ensures that what we're trying to erase is a regular file. It effectively
|
||||
// prevents LLVM from erasing things like /dev/null, any block special file,
|
||||
// or other things that aren't "regular" files.
|
||||
if (Status.isFile) {
|
||||
if (unlink(path.c_str()) != 0)
|
||||
return GetErrno(path + ": can't destroy file", ErrStr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user