Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
ancode
· 5y ago · 0 comments
There's a syscall to check whether the computer is on so just call that before this and you'll be fine
Comments
[–]
Someone
5y ago
That introduces a time-of-check to time-of-use bug (
https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use
).
[–]
waterhouse
5y ago
Aha. If only the API was "Execute a user-provided function in a context where the computer is guaranteed to be on".
[–]
nvader
5y ago
Ah, good ole TOCTOU