LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0129-run_erl-Fix-error-handling-in-sf_close-and-during-pt.patch of Package erlang (Project home:Ledest:erlang:20)

From b65da429eb5c1f680c637480105f122befc53d61 Mon Sep 17 00:00:00 2001
From: Marko Turk <marko@markoturk.info>
Date: Sat, 22 Jul 2017 21:47:56 +0200
Subject: [PATCH] run_erl: Fix error handling in sf_close and during pty master
 read

---
 erts/etc/unix/run_erl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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
-- 
2.15.1