diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-21 01:25:37 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-21 01:25:37 +0000 |
| commit | 37575693186976cf7828832e48b4b75edc469cd1 (patch) | |
| tree | 9011d8b634b05732bd5ca382efbc65ef9784d888 /llvm/lib/Support/Unix | |
| parent | f1b10242c071a049fb4fdf9cf332946ed8dee367 (diff) | |
| download | bcm5719-llvm-37575693186976cf7828832e48b4b75edc469cd1.tar.gz bcm5719-llvm-37575693186976cf7828832e48b4b75edc469cd1.zip | |
[Support] Make sure sys::fs::remove can remove symbolic links and make sure LockFileManager can handle a symbolic link that points nowhere.
llvm-svn: 204422
Diffstat (limited to 'llvm/lib/Support/Unix')
| -rw-r--r-- | llvm/lib/Support/Unix/Path.inc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 500b7fecb74..1c910536106 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -305,7 +305,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) { StringRef p = path.toNullTerminatedStringRef(path_storage); struct stat buf; - if (stat(p.begin(), &buf) != 0) { + if (lstat(p.begin(), &buf) != 0) { if (errno != errc::no_such_file_or_directory || !IgnoreNonExisting) return error_code(errno, system_category()); return error_code::success(); @@ -316,7 +316,7 @@ error_code remove(const Twine &path, bool IgnoreNonExisting) { // 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 (!S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode)) + if (!S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode) && !S_ISLNK(buf.st_mode)) return make_error_code(errc::operation_not_permitted); if (::remove(p.begin()) == -1) { |

