… | |
… | |
919 | */ |
919 | */ |
920 | { |
920 | { |
921 | off_t sbytes; |
921 | off_t sbytes; |
922 | res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); |
922 | res = sendfile (ifd, ofd, offset, count, 0, &sbytes, 0); |
923 | |
923 | |
|
|
924 | #if 0 /* according to the manpage, this is correct, but broken behaviour */ |
924 | /* freebsd' sendfile will return 0 on success */ |
925 | /* freebsd' sendfile will return 0 on success */ |
925 | /* freebsd 8 documents it as only setting *sbytes on EINTR and EAGAIN, but */ |
926 | /* freebsd 8 documents it as only setting *sbytes on EINTR and EAGAIN, but */ |
926 | /* not on e.g. EIO or EPIPE - sounds broken */ |
927 | /* not on e.g. EIO or EPIPE - sounds broken */ |
927 | if ((res < 0 && (errno == EAGAIN || errno == EINTR) && sbytes) || res == 0) |
928 | if ((res < 0 && (errno == EAGAIN || errno == EINTR) && sbytes) || res == 0) |
|
|
929 | res = sbytes; |
|
|
930 | #endif |
|
|
931 | |
|
|
932 | /* according to source inspection, this is correct, and useful behaviour */ |
|
|
933 | if (sbytes) |
928 | res = sbytes; |
934 | res = sbytes; |
929 | } |
935 | } |
930 | |
936 | |
931 | # elif defined (__APPLE__) |
937 | # elif defined (__APPLE__) |
932 | |
938 | |