[PATCH] D85690: [split-file] Fix sys::fs::remove() on Solaris after D83834
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 15:03:01 PDT 2020
MaskRay created this revision.
MaskRay added a reviewer: ro.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
MaskRay requested review of this revision.
where stdio.h ::remove() may set errno to EEXIST instead of ENOTEMPTY.
POSIX.1-2017 allows EEXIST for unlink() (which is called by remove()):
> [EEXIST] or [ENOTEMPTY]
> The flag parameter has the AT_REMOVEDIR bit set and the path argument names a directory that is not an empty directory, or there are hard links to the directory other than dot or a single entry in dot-dot.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85690
Files:
llvm/tools/split-file/split-file.cpp
Index: llvm/tools/split-file/split-file.cpp
===================================================================
--- llvm/tools/split-file/split-file.cpp
+++ llvm/tools/split-file/split-file.cpp
@@ -166,7 +166,8 @@
status.type() != sys::fs::file_type::regular_file)
fatal(output, "output cannot be a special file");
if (std::error_code ec = sys::fs::remove(output, /*IgnoreNonExisting=*/true))
- if (ec.value() != static_cast<int>(std::errc::directory_not_empty))
+ if (ec.value() != static_cast<int>(std::errc::directory_not_empty) &&
+ ec.value() != static_cast<int>(std::errc::file_exists))
fatal(output, ec.message());
return handle(**bufferOrErr, input);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85690.284511.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200810/750fe755/attachment.bin>
More information about the llvm-commits
mailing list