[raw_fd_ostream] report actual error in error messages
Summary:
Previously, we would emit error messages like "IO failure on output
stream". This change causes use to include information about what
actually went wrong, e.g. "No space left on device".
Reviewers: sunfish, rnk
Reviewed By: rnk
Subscribers: mehdi_amini, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D39203
llvm-svn: 316404
diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp
index 3ee3af7..81f3fd0 100644
--- a/llvm/lib/Support/LockFileManager.cpp
+++ b/llvm/lib/Support/LockFileManager.cpp
@@ -201,12 +201,11 @@
Out.close();
if (Out.has_error()) {
- // We failed to write out PID, so make up an excuse, remove the
+ // We failed to write out PID, so report the error, remove the
// unique lock file, and fail.
- auto EC = make_error_code(errc::no_space_on_device);
std::string S("failed to write to ");
S.append(UniqueLockFileName.str());
- setError(EC, S);
+ setError(Out.error(), S);
sys::fs::remove(UniqueLockFileName);
return;
}