summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Support/Path.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 59c3798712..d5a0ec55c6 100644
--- a/lib/Support/Path.cpp
+++ b/lib/Support/Path.cpp
@@ -1065,7 +1065,7 @@ std::error_code identify_magic(const Twine &Path, file_magic &Result) {
char Buffer[32];
int Length = read(FD, Buffer, sizeof(Buffer));
- if (Length < 0)
+ if (close(FD) != 0 || Length < 0)
return std::error_code(errno, std::generic_category());
Result = identify_magic(StringRef(Buffer, Length));