Page MenuHomeFreeBSD

sleep: fix SIGINFO output and modernize interval parsing
Needs ReviewPublic

Authored by nvsrahul_hotmail.com on Jan 18 2026, 12:47 PM.
Tags
None
Referenced Files
F151372482: D54765.id170000.diff
Tue, Apr 7, 11:13 PM
F151343949: D54765.id170004.diff
Tue, Apr 7, 6:18 PM
Unknown Object (File)
Mar 8 2026, 5:09 PM
Unknown Object (File)
Mar 8 2026, 10:26 AM
Unknown Object (File)
Mar 8 2026, 10:25 AM
Unknown Object (File)
Mar 8 2026, 10:25 AM
Unknown Object (File)
Mar 7 2026, 10:38 PM
Unknown Object (File)
Mar 7 2026, 12:48 PM
Subscribers

Details

Reviewers
imp
Summary

Replace sscanf-based interval parsing with strtod(3) to match
documented behavior and improve error handling. Fix SIGINFO
handling to print remaining sleep time to stdout as specified
by sleep(1).

Signed-off-by: NVSRahul <nvsrahul@hotmail.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69972
Build 66855: arc lint + arc unit

Event Timeline

  • sleep: fix SIGINFO output and modernize interval parsing

Updating D54765: sleep: fix SIGINFO output and modernize interval parsing

Updating D54765: sleep: fix SIGINFO output and modernize interval parsing

Updating D54765: sleep: fix SIGINFO output and modernize interval parsing

Updating D54765: sleep: fix SIGINFO output and modernize interval parsing

Updating D54765: sleep: fix SIGINFO output and modernize interval parsing

Updated D54765: sleep: fix SIGINFO output and modernize interval parsing

bin/sleep/sleep.c
92

So if endptr[0] was NUL, what guarantees endptr[1] is also NUL.

Updated D54765: sleep: fix SIGINFO output and modernize interval parsing

Good catch, thanks.
When *endptr == '\0', accessing endptr[1] is invalid.
I’ve updated the logic to only check endptr[1] when a unit
character is present, avoiding a read past the string terminator.