aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2012-03-14 20:02:43 +0100
committerLukas Larsson <[email protected]>2012-03-20 10:34:06 +0100
commit3618672c3e4746fada7464b2e31bf7c3ad0b3b88 (patch)
tree68a9b884be480efd58763a04099286221e61a7f7 /erts/emulator/drivers/common
parenta9dac8d98a9b848426961087b2567ddeb9c05395 (diff)
downloadotp-3618672c3e4746fada7464b2e31bf7c3ad0b3b88.tar.gz
otp-3618672c3e4746fada7464b2e31bf7c3ad0b3b88.tar.bz2
otp-3618672c3e4746fada7464b2e31bf7c3ad0b3b88.zip
Fix bug when sending long files using select
The return value from efile_sendfile was not consistent inbetween platforms. The API should now be working as it was intended. OTP-9994
Diffstat (limited to 'erts/emulator/drivers/common')
-rw-r--r--erts/emulator/drivers/common/efile_drv.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 7a80b382b1..ad0e371950 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -1777,20 +1777,16 @@ static void invoke_sendfile(void *data)
d->c.sendfile.written += nbytes;
- if (result == 1) {
- if (USE_THRDS_FOR_SENDFILE) {
- d->result_ok = 0;
- } else if (d->c.sendfile.nbytes == 0 && nbytes != 0) {
- d->result_ok = 1;
- } else if ((d->c.sendfile.nbytes - nbytes) != 0) {
- d->result_ok = 1;
- d->c.sendfile.nbytes -= nbytes;
- } else {
- d->result_ok = 0;
- }
+ if (result == 1 || (result == 0 && USE_THRDS_FOR_SENDFILE)) {
+ d->result_ok = 0;
} else if (result == 0 && (d->errInfo.posix_errno == EAGAIN
|| d->errInfo.posix_errno == EINTR)) {
+ if ((d->c.sendfile.nbytes - nbytes) != 0) {
d->result_ok = 1;
+ if (d->c.sendfile.nbytes != 0)
+ d->c.sendfile.nbytes -= nbytes;
+ } else
+ d->result_ok = 0;
} else {
d->result_ok = -1;
}