Hacker News new | ask | show | jobs
by ancode 1678 days ago
There's a syscall to check whether the computer is on so just call that before this and you'll be fine
1 comments

That introduces a time-of-check to time-of-use bug (https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use).
Aha. If only the API was "Execute a user-provided function in a context where the computer is guaranteed to be on".
Ah, good ole TOCTOU