Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeatedly divide read buffer size by 8 until success. Fixes #11481. #18332

Merged
merged 1 commit into from
Sep 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Repeatedly divide read buffer size by 8 until success. Fixes #11481.
Dividing by 8 leads to success on the second try in the case of the failure of --lisp on Windows 7.
  • Loading branch information
twadleigh committed Sep 2, 2016
commit 0440507b4df7a24d3d5b66401b4f76ab81320412
8 changes: 7 additions & 1 deletion src/support/ios.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ static int _os_read(long fd, void *buf, size_t n, size_t *nread)
{
ssize_t r;

n = LIMIT_IO_SIZE(n);
while (1) {
set_io_wait_begin(1);
r = read((int)fd, buf, LIMIT_IO_SIZE(n));
r = read((int)fd, buf, n);
set_io_wait_begin(0);
if (r > -1) {
*nread = (size_t)r;
return 0;
}
// This test is a hack to fix #11481 for Windows 7. Unnecessary for Windows 10.
if (errno == ENOMEM && n > 80) {
n >>= 3;
continue;
}
if (!_enonfatal(errno)) {
*nread = 0;
return errno;
Expand Down