This patch makes it possible to communicate process name or JOB[:ID]
from initctl to Finit. When the process name translates into a service
with multiple instances Finit applies the requested command to all
instances. For example, two Dropbear SSH services running on two
different ports, calling `initctl stop dropbear` stops both services.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Replace `remove()` with our own `erase()` which checks the return value
and warns on actual real failure.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
We must check the return value from `accept()`, it may fail. Also, we
should probably retry the syscall in some cases ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When receiving a start/stop/reload/restart request from initctl we must
make sure to validate and NUL terminate the job ID. The `read()` API
does not NUL terminate strings for us and we cannot rely on `initctl` or
any other external API user to do so for us.
This patch improves error and boundary checking.
- Use memcpy() + hard termination instead.
- Fix use of strchr() on possibly non-NUL terminated string.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>