From 33fb92edc2a9958234b1bc2431a17fa4edbd83ea Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Wed, 27 May 2026 00:07:38 -0700 Subject: deal properly with EINTR from sys-read this will be necessary to resume after running a signal handler. it had a bug where any error code other than ENOENT would be treated as a number of bytes read, resulting in a negative value for the buffer's logical length. amazingly this didn't crash, but it wasn't great. anyway now that's all fixed Force-Push: yes Change-Id: I1c2b45d8efd531c121c5695cdf0cc74609c80547 --- input.e | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/input.e b/input.e index dd1da1c..52fe717 100644 --- a/input.e +++ b/input.e @@ -229,8 +229,10 @@ ~ Check whether the buffer is full. If not, do a read. If so, that's not ~ an error, just clean up and take no action. dup { swap sys-read - dup -2 = - { drop drop s" Read error." emitstring 0 sys-exit } + dup 0 > { + dup -4 = + { drop recurse } + { drop drop s" Read error." emitstring 0 sys-exit } if-else } { swap dup buffer-logical-length @ 3roll + swap buffer-logical-length ! } if-else } { drop drop } if-else ; -- cgit 1.4.1