From 1e19ca247a4507f2895eace9f1dd76cea8e97b2c Mon Sep 17 00:00:00 2001
From: Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
Date: Sat, 26 Oct 2013 20:06:35 +0200
Subject: [PATCH] handle stdin EOF

---
 native/drivers/native-uart0.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/native/drivers/native-uart0.c b/native/drivers/native-uart0.c
index 70d545a36b..b9d8b041d3 100644
--- a/native/drivers/native-uart0.c
+++ b/native/drivers/native-uart0.c
@@ -60,6 +60,14 @@ void _native_handle_uart0_input()
     if (nread == -1) {
         err(1, "_native_handle_uart0_input(): read()");
     }
+    else if (nread == 0) {
+        /* XXX:
+         * preliminary resolution for this situation, will be coped
+         * with properly in #161 */
+        close(_native_uart_in);
+        _native_uart_in = -1;
+        warnx("stdin closed");
+    }
     for(int pos = 0; pos < nread; pos++) {
         uart0_handle_incoming(buf[pos]);
     }
-- 
GitLab