aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-09-17 16:03:48 +0200
committerRickard Green <[email protected]>2015-09-17 16:03:48 +0200
commit803b9f8b80ca937dd5b62c594a115fc4aa554b33 (patch)
tree7f40b0b4de60b529bc00889f778a561a026cf7a0
parent906d515b76abd98b7c0db52db484d2d7a0ba70bf (diff)
parent3a33ee25ec2f9da0194a76649782154f41076cc9 (diff)
downloadotp-803b9f8b80ca937dd5b62c594a115fc4aa554b33.tar.gz
otp-803b9f8b80ca937dd5b62c594a115fc4aa554b33.tar.bz2
otp-803b9f8b80ca937dd5b62c594a115fc4aa554b33.zip
Merge branch 'maint'
* maint: 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) {