Unlink the control socket on clean shutdown
Previously, the behaviour was to unlink any control socket sat where we wanted to open ours. This would make us lose control of running servers if we happened to collide accidentally. With this patch, the new process will abort() if there is a control socket squatting on the path we want, and unlink it when it closes. This means that an unclean shutdown will leave a dangling, unattached control socket which will block a restart, but that's a better option than intentionally cutting off running servers.
This commit is contained in:
15
src/util.c
15
src/util.c
@@ -18,18 +18,17 @@ void error_init(void)
|
||||
pthread_key_create(&cleanup_handler_key, free);
|
||||
}
|
||||
|
||||
void error_handler(int fatal __attribute__ ((unused)) )
|
||||
void error_handler(int fatal)
|
||||
{
|
||||
DECLARE_ERROR_CONTEXT(context);
|
||||
|
||||
if (!context) {
|
||||
/* FIXME: This can't be right - by default we exit()
|
||||
* with a status of 0 in this case.
|
||||
*/
|
||||
pthread_exit((void*) 1);
|
||||
if (context) {
|
||||
longjmp(context->jmp, fatal ? 1 : 2 );
|
||||
}
|
||||
else {
|
||||
if ( fatal ) { abort(); }
|
||||
else { pthread_exit((void*) 1); }
|
||||
}
|
||||
|
||||
longjmp(context->jmp, fatal ? 1 : 2 );
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user