diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-06-20 15:56:05 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-06-20 15:56:05 +0000 |
commit | 6eb44843194f9a432d68806f5bc066d7fa24017e (patch) | |
tree | b20ccd80aebb33804c7b373934f7fa8b4984a852 /llvm/lib/Support | |
parent | ef852916707557f18cb8eaac2c5035a406f12380 (diff) | |
download | bcm5719-llvm-6eb44843194f9a432d68806f5bc066d7fa24017e.tar.gz bcm5719-llvm-6eb44843194f9a432d68806f5bc066d7fa24017e.zip |
Fix get_magic() handling of short reads.
PR16389
llvm-svn: 184434
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/Unix/PathV2.inc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc index 9602daad08f..39b33123de8 100644 --- a/llvm/lib/Support/Unix/PathV2.inc +++ b/llvm/lib/Support/Unix/PathV2.inc @@ -694,7 +694,7 @@ error_code get_magic(const Twine &path, uint32_t len, if (std::ferror(file) != 0) { std::fclose(file); return error_code(errno, system_category()); - } else if (size != result.size()) { + } else if (size != len) { if (std::feof(file) != 0) { std::fclose(file); result.set_size(size); @@ -702,7 +702,7 @@ error_code get_magic(const Twine &path, uint32_t len, } } std::fclose(file); - result.set_size(len); + result.set_size(size); return error_code::success(); } |