forked from bertha/berthad
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround FreeBSD's sendfile not reading data from the disk. bertha#5
Signed-off-by: Jille Timmermans <[email protected]>
- Loading branch information
Showing
1 changed file
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71e393c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does dadbb9a work for you?
71e393c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would. If sendfile(2) does actually transmit some bytes it doesn't change the file-offset so read(2) reads a random piece of data instead of the next byte of the wanted data. The lseek(2) should be done before the read.
There was a (efficiency) reason why I did the lseek(2) at the end of the function instead of just before the read(2), but I'm afraid I forgot why.