diff options
author | Marko Turk <[email protected]> | 2017-07-22 21:47:56 +0200 |
---|---|---|
committer | Marko Turk <[email protected]> | 2017-08-12 22:52:24 +0200 |
commit | b65da429eb5c1f680c637480105f122befc53d61 (patch) | |
tree | aa0bcdb49207f95e9318688e74a22428d7820e9d | |
parent | 3d1335be3cde81efff7ba55140d52c2a2d032e8f (diff) | |
download | otp-b65da429eb5c1f680c637480105f122befc53d61.tar.gz otp-b65da429eb5c1f680c637480105f122befc53d61.tar.bz2 otp-b65da429eb5c1f680c637480105f122befc53d61.zip |
run_erl: Fix error handling in sf_close and during pty master read
-rw-r--r-- | erts/etc/unix/run_erl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c index f05c729eeb..f928163705 100644 --- a/erts/etc/unix/run_erl.c +++ b/erts/etc/unix/run_erl.c @@ -627,12 +627,14 @@ static void pass_on(pid_t childpid) status("Pty master read; "); #endif if ((len = sf_read(mfd, buf, BUFSIZ)) <= 0) { + int saved_errno = errno; sf_close(rfd); if(wfd) sf_close(wfd); sf_close(mfd); unlink(fifo1); unlink(fifo2); if (len < 0) { + errno = saved_errno; if(errno == EIO) ERROR0(LOG_ERR,"Erlang closed the connection."); else @@ -1342,13 +1344,15 @@ static int sf_open(const char *path, int type, mode_t mode) { return fd; } + static int sf_close(int fd) { int res = 0; - do { res = close(fd); } while(fd < 0 && errno == EINTR); + do { res = close(fd); } while(res < 0 && errno == EINTR); return res; } + /* Extract any control sequences that are ment only for run_erl * and should not be forwarded to the pty. */ |