Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We used to create an empty pidfile, and write the pid only after starting the interface. Having pidfile without a pid does not make sense, as other processes cannot use the pid to terminate the process. For example if starting the interface is blocking for long time due to a bug, we are left with unhelpful pid file. To keep the main flow more clear, add a helper to create and remove the pid file. The helpers check all errors and log better log messages using ERRORF instead of ERRORN, including the pidfile path. Previously if we got a short write to the pidfile, we log bogus error since errno is set only when write return negative return value. Rename pid_fd to pidfile_fd to avoid confusion with Linux's pidfd https://man7.org/linux/man-pages/man2/pidfd_open.2.html. Signed-off-by: Nir Soffer <[email protected]>
- Loading branch information