Skip to content

Signal handlers must preserve errno - #219

Merged
troglobit merged 1 commit into
troglobit:masterfrom
bluhm:save-errno
Jul 18, 2026
Merged

Signal handlers must preserve errno#219
troglobit merged 1 commit into
troglobit:masterfrom
bluhm:save-errno

Conversation

@bluhm

@bluhm bluhm commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

If a signal handler executes a system call, the errno may be modified. After return to the main program, this new errno does not reflect the error of the previously failed system call in the main context. Common pattern for signal handlers is to save and restore the errno.

If a signal handler executes a system call, the errno may be modified.
After return to the main program, this new errno does not reflect
the error of the previously failed system call in the main context.
Common pattern for signal handlers is to save and restore the errno.

Signed-off-by: Alexander Bluhm <bluhm@openbsd.org>

@troglobit troglobit left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice finding! 👍

@troglobit
troglobit merged commit 501a986 into troglobit:master Jul 18, 2026
2 checks passed
@bluhm
bluhm deleted the save-errno branch July 18, 2026 19:27
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