srv, ibus: remove the endpoints on a signal too
A stopped daemon left its socket and IBus address file behind, since plan9port ends a process on SIGTERM without running exit handlers. Both files now go on a note as well as on exit, and only while they are still the ones this daemon made, so a successor is never robbed of its own.
This commit is contained in:
10
ibus.c
10
ibus.c
@@ -69,6 +69,15 @@ unlinkaddr(void)
|
||||
addrino = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
addrnote(void *v, char *note)
|
||||
{
|
||||
USED(v);
|
||||
USED(note);
|
||||
unlinkaddr();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
machineidfiles(char *buf, int sz, char **path, int npath)
|
||||
{
|
||||
@@ -984,6 +993,7 @@ ibusinit(void)
|
||||
goto fail;
|
||||
}
|
||||
cleanupregistered = 1;
|
||||
threadnotify(addrnote, 1);
|
||||
if(writeaddr(addrfile, full) < 0){
|
||||
fprintf(stderr, "strans: ibus: cannot write %s\n", addrfile);
|
||||
goto fail;
|
||||
|
||||
Reference in New Issue
Block a user