service: stop the restart counter of restart always from overflowing

The restart counter is a char, and with restart always nothing stops
it.  A service restarted more often than the counter ages wrapped it
after 127 restarts, 255 on Arm.  initctl status then showed a negative
count and the back-off fell back to two seconds.

Make the counter an int that stops at INT_MAX.  With restart always it
stops at 10, the default restart-max.  The back-off peaks at half of
that, and from 10 the counter ages back within the hour.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-19 20:39:41 +01:00
1 parent 4e1b0d4fbe
commit 644279cd72
3 files changed
+20 -7

No files matched your search

+4
View File
@@ -188,6 +188,10 @@ All relevant changes are documented in this file.
- Fix a command whose name starts like a service option, e.g. `logger` or
`pidof`. It was taken as the `log` or `pid` option and the next argument
ran as the command, which also broke the `logger` example in finit.conf(5)
- Fix the restart counter of a service with `restart = "always"`, nothing
stopped it and it overflowed after 127 restarts, 255 on Arm. It now
stops at 10, where the back-off has long since peaked, and ages from
there
- Fix `restart = "always"` skipping the initial two second delay between
restarts, every restart waited five seconds
- Reject a .conf file that declares the same block title twice. The title is