aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-09-17 16:02:59 +0200
committerRickard Green <[email protected]>2015-09-17 16:02:59 +0200
commit3a33ee25ec2f9da0194a76649782154f41076cc9 (patch)
tree7348ddb96596ed8bac0b9a0ae283bf7d15d0f41a
parent6c9f25aafc8682387f13f6a6ac505ffaeff476c0 (diff)
parent11cf60809a26155c7904771974739f4a51911c93 (diff)
downloadotp-3a33ee25ec2f9da0194a76649782154f41076cc9.tar.gz
otp-3a33ee25ec2f9da0194a76649782154f41076cc9.tar.bz2
otp-3a33ee25ec2f9da0194a76649782154f41076cc9.zip
Merge branch 'lukas/erts/ttsl_eintr/OTP-12987' into maint
* lukas/erts/ttsl_eintr/OTP-12987: erts: Make sure to deal with EINTR write failures
-rw-r--r--erts/emulator/drivers/unix/ttsl_drv.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c
index 53146e71f0..25cad37e25 100644
--- a/erts/emulator/drivers/unix/ttsl_drv.c
+++ b/erts/emulator/drivers/unix/ttsl_drv.c
@@ -733,13 +733,13 @@ static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, ErlDrvSizeT coun
else
written = 0;
if (written < 0) {
- if (errno == EAGAIN) {
+ if (errno == ERRNO_BLOCK || errno == EINTR) {
driver_select(ttysl_port,(ErlDrvEvent)(long)ttysl_fd,
ERL_DRV_USE|ERL_DRV_WRITE,1);
break;
} else {
- /* we ignore all other errors */
- break;
+ driver_failure_posix(ttysl_port, errno);
+ return;
}
} else {
if (driver_deq(ttysl_port, written) == 0)
@@ -779,11 +779,12 @@ static void ttysl_to_tty(ErlDrvData ttysl_data, ErlDrvEvent fd) {
else
written = 0;
if (written < 0) {
- if (errno == EAGAIN) {
- break;
- } else {
- /* we ignore all other errors */
+ if (errno == EINTR) {
+ continue;
+ } else if (errno != ERRNO_BLOCK){
+ driver_failure_posix(ttysl_port, errno);
}
+ break;
} else {
sz = driver_deq(ttysl_port, written);
if (sz < TTY_BUFFSIZE && ttysl_send_ok) {