Fix wrapvFull for the case when iovec* has size more than 1024
authorIaroslav Tverdokhlib <iaroslav@fb.com>
Tue, 16 Feb 2016 18:21:35 +0000 (10:21 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Tue, 16 Feb 2016 19:20:26 +0000 (11:20 -0800)
commit7488256f231499910ba90ecbd8243f8f89302fd3
tree6c68e63894a0840875dddeb96b1ab3dbe6b1dc71
parente2fe17aecbab23842517ffec8273ff5ba12e8681
Fix wrapvFull for the case when iovec* has size more than 1024

Summary: `folly::wrapvFull` fail if the passed in `iovec*` has more than 1024 (`IOV_MAX`) elements. In particular, it returns -1 with errno 22 [Invalid argument]. The fix is to limit maximum size of iovec* to IOV_MAX that is passed in to `readv/writev/...` in a single iteration of outer loop.

Reviewed By: yfeldblum

Differential Revision: D2935540

fb-gh-sync-id: 6c0a073ac0b59db3d53fb4269b13ddfcc479efb1
shipit-source-id: 6c0a073ac0b59db3d53fb4269b13ddfcc479efb1
folly/detail/FileUtilDetail.h
folly/test/FileUtilTest.cpp