Skip to content

Conversation

@purplesyringa
Copy link
Contributor

The comment // The closure now ONLY contains async-signal-safe syscall wrappers. is misleading, since allocations are not async-signal-safe. There are three sources of allocation:

I've moved out CString::new similarly to other strings, hopefully that's idiomatic for your project.

Error::other and format! are trickier. Error messages are not transferred across pre_exec boundary, so whatever error messages you wrote were never visible. I replaced error handling with ?, which uses the non-allocating impl From<nix::Error> for std::io::Error, under assumption that if error messages weren't transmitted before, it's fine to ignore them now.

Another possible alternative would be to use .expect, effectively transmitting the error via stderr. I couldn't make a judgement on whether that's correct for use case, so I refrained from doing that.

@jamesmcm
Copy link
Owner

Thanks, good catch! (and for documenting it upstream).

This might also make a good Clippy lint.

@jamesmcm jamesmcm merged commit 2ecd026 into jamesmcm:master Nov 17, 2025
1 of 2 checks passed
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