diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-05-27 00:07:38 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-05-27 00:07:38 -0700 |
| commit | 33fb92edc2a9958234b1bc2431a17fa4edbd83ea (patch) | |
| tree | d0353520e178e44a5c1fddc01b9bd7fe481b5a8a /input.e | |
| parent | 24d9dcc942f8a00af682b9032575f8a5864efdc5 (diff) | |
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
Diffstat (limited to 'input.e')
| -rw-r--r-- | input.e | 6 |
1 files 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 ; |