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:
2026-08-16 21:40:42 +09:00
parent 48d3e165c3
commit bab6077c75
3 changed files with 47 additions and 5 deletions

10
ibus.c
View File

@@ -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;