summaryrefslogtreecommitdiff
path: root/tests/diff/patchid.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-03-28 10:12:23 +0200
committerPatrick Steinhardt <ps@pks.im>2017-04-04 11:58:46 +0200
commit9daba9f4b690d7450f0bbb4e999914b03bbe57a7 (patch)
treefd2e1bc84e6a65fa676adcb59f285dc2f246520d /tests/diff/patchid.c
parent756138e4755c93265e34704ee95874c0d81425e5 (diff)
downloadlibgit2-9daba9f4b690d7450f0bbb4e999914b03bbe57a7.tar.gz
fileops: do not overwrite correct error message on mmap
When executing `git_futils_mmap_ro_file`, we first try to guess whether the file is mmapable at all. Part of this check is whether the file is too large to be mmaped, which can be true on systems with 32 bit `size_t` types. The check is performed by first getting the file size wtih `git_futils_filesize` and then checking whether the returned size can be represented as `size_t`, returning an error if so. While this test also catches the case where the function returned an error (as `-1` is not representable by `size_t`), we will set the misleading error message "file too large to mmap". But in fact, a negative return value from `git_futils_filesize` will be caused by the inability to fstat the file. Fix the error message by handling negative return values separately and not overwriting the error message in that case.
Diffstat (limited to 'tests/diff/patchid.c')
0 files changed, 0 insertions, 0 deletions