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 | 4828eacaf3f620fbb11a5dc9d162c134a30b52a7 (patch) | |
| tree | fc5c42596c68571afd0dc8059bd8c4e480f71f10 | |
| parent | 438600e697448ff704770825d6b92d95ee250905 (diff) | |
| download | external_llvm-4828eacaf3f620fbb11a5dc9d162c134a30b52a7.zip external_llvm-4828eacaf3f620fbb11a5dc9d162c134a30b52a7.tar.gz external_llvm-4828eacaf3f620fbb11a5dc9d162c134a30b52a7.tar.bz2 | |
Fix get_magic() handling of short reads.
PR16389
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184434 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/Support/Unix/PathV2.inc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc index 9602daa..39b3312 100644 --- a/lib/Support/Unix/PathV2.inc +++ b/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(); } |
