Klaus Demo ~jonashaag/bjoern / 42bad3b
Fix #144 Jonas Haag 2 years ago
1 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
1212
1313 Py_ssize_t portable_sendfile(int out_fd, int in_fd, off_t offset) {
1414 off_t len = SENDFILE_CHUNK_SIZE;
15 if(sendfile(in_fd, out_fd, offset, &len, NULL, 0) == -1)
15 if(sendfile(in_fd, out_fd, offset, &len, NULL, 0) == -1) {
16 if((errno == EAGAIN || errno == EINTR) && len > 0) {
17 return len;
18 }
1619 return -1;
20 }
1721 return len;
1822 }
1923
2529 Py_ssize_t portable_sendfile(int out_fd, int in_fd, off_t offset) {
2630 off_t len;
2731 if(sendfile(in_fd, out_fd, offset, SENDFILE_CHUNK_SIZE, NULL, &len, 0) == -1) {
32 if((errno == EAGAIN || errno == EINTR) && len > 0) {
33 return len;
34 }
2835 return -1;
2936 }
3037 return len;