core: Fix unreadchar on string port when unreading EOF.

* src/posix.c (unreadchar): Fix on string port when unreading EOF.
This commit is contained in:
Danny Milosavljevic 2020-06-14 22:41:31 +02:00
parent 449f3c7e00
commit 3b312ca983
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5
1 changed files with 2 additions and 0 deletions

View File

@ -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);