[libFuzzer] Print a correct error message when a directory can't be
opened.
Summary:
Currently if the directory cannot be opened for a reason other than
non-existence (e.g. too many open file descriptors) the error message
printed is incredibly confusing.
Patch By: Alex Gaynor
Reviewers: kcc, morehouse
Reviewed By: morehouse
Subscribers: delcypher, llvm-commits, Sanitizers
Differential Revision: https://reviews.llvm.org/D45322
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@329438 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/FuzzerIOPosix.cpp b/FuzzerIOPosix.cpp
index 2257751..17e884d 100644
--- a/FuzzerIOPosix.cpp
+++ b/FuzzerIOPosix.cpp
@@ -54,7 +54,7 @@
DIR *D = opendir(Dir.c_str());
if (!D) {
- Printf("No such directory: %s; exiting\n", Dir.c_str());
+ Printf("%s: %s; exiting\n", strerror(errno), Dir.c_str());
exit(1);
}
while (auto E = readdir(D)) {