diff options
author | Lukas Larsson <[email protected]> | 2017-08-16 17:12:17 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-08-16 17:12:17 +0200 |
commit | 856eb2e75ec0ed37c7dedaeb0772803988ffee82 (patch) | |
tree | 4fb019c36c0ad14671efbf47bd6c8924f8dba141 /erts | |
parent | 911c57effa7b834ed249f8ab59486127e0427dc2 (diff) | |
parent | b65da429eb5c1f680c637480105f122befc53d61 (diff) | |
download | otp-856eb2e75ec0ed37c7dedaeb0772803988ffee82.tar.gz otp-856eb2e75ec0ed37c7dedaeb0772803988ffee82.tar.bz2 otp-856eb2e75ec0ed37c7dedaeb0772803988ffee82.zip |
marko-turk/run_erl-errno-fix/PR1529/OTP-14537
run_erl: Fix error handling in sf_close and during pty master read
Diffstat (limited to 'erts')
-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. */ |