summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/loop.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f2404aeba..890779515 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-26  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Martijn Dekker: 39448: Src/loop.c: reset REPLY in select when
+	needed on user action.
+
 2016-09-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 39436: Src/exec.c, Src/signals.c: Don't execute builtin if
diff --git a/Src/loop.c b/Src/loop.c
index fa7602e37..3b9d02144 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -289,6 +289,8 @@ execselect(Estate state, UNUSED(int do_exec))
 	    	}
 	    } else
 		str = (char *)getlinknode(bufstack);
+            if (!str && !errflag)
+                setsparam("REPLY", ztrdup("")); /* EOF (user pressed Ctrl+D) */
 	    if (!str || errflag) {
 		if (breaks)
 		    breaks--;