Why is charon.pid deleted before SA teardown is performed?
In the main function of charon:
/* normal termination, cleanup and exit */ unlink_pidfile(); status = 0; deinit: libcharon_deinit(); library_deinit(); return status;
When charon tries to exit, it deletes charon.pid file and then do some cleanup.
It seems to make more sense to delete charon.pid afterwards, so that the existence of charon.pid better indicates whenter charon is still alive. Or else there seems no convenient to check the liveness of charon if not wanting to use ps or top.
charon: Unlink PID file after daemon deinit (i.e. after unloading plugins etc.)
Make sure, though, that we only remove the file if we actually
created it (e.g. not for --help or --version). And do so before
deinitializing libstrongswan due to leak detective.
#1 Updated by Tobias Brunner over 2 years ago
- Status changed from New to Feedback
I guess we could do that later, but must ensure we don't delete the PID file if we didn't actually create it (e.g. if we abort due to an already existing PID file, or when called with
--help). I pushed a commit to the 2460-pidfile-unlink branch.