Skip to content

fix(libc): correct transient-errno predicate in js_waker_signal#1480

Open
andreasrosdal wants to merge 1 commit into
quickjs-ng:masterfrom
nordstjernen-web:claude/sec-waker-errno-predicate
Open

fix(libc): correct transient-errno predicate in js_waker_signal#1480
andreasrosdal wants to merge 1 commit into
quickjs-ng:masterfrom
nordstjernen-web:claude/sec-waker-errno-predicate

Conversation

@andreasrosdal
Copy link
Copy Markdown
Contributor

The retry loop in js_waker_signal used errno != EAGAIN || errno != EINTR, which is always true (any single errno value is unequal to at least one of the two), so the loop bailed on the first short-write error and silently dropped the wakeup. Replace with && so the loop only exits on a fatal errno.

No test: js_waker_signal's transient-error path is reached only when the pipe is full or the syscall is interrupted by a signal, neither of which is reliably reproducible in a portable unit test.

The retry loop in js_waker_signal used `errno != EAGAIN || errno != EINTR`,
which is always true (any single errno value is unequal to at least one of
the two), so the loop bailed on the first short-write error and silently
dropped the wakeup. Replace with `&&` so the loop only exits on a fatal
errno.

No test: js_waker_signal's transient-error path is reached only when the
pipe is full or the syscall is interrupted by a signal, neither of which
is reliably reproducible in a portable unit test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants