bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] core: Fix unreadchar on string port when unreading EOF.


From: Danny Milosavljevic
Subject: [PATCH] core: Fix unreadchar on string port when unreading EOF.
Date: Sun, 14 Jun 2020 22:43:10 +0200

* src/posix.c (unreadchar): Fix on string port when unreading EOF.
---
 src/posix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/posix.c b/src/posix.c
index fd753232..0ef1a599 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -71,6 +71,8 @@ unreadchar (int c)
 {
   if (__stdin >= 0)
     return fdungetc (c, __stdin);
+  if (c == EOF) // can't unread EOF
+    return c;
   SCM port = current_input_port ();
   SCM string = STRING (port);
   size_t length = LENGTH (string);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]