diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-08-13 21:46:13 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-08-13 21:46:13 +0200 |
commit | 508b53a29a74d2ded6b15ffc8be0a182b258869a (patch) | |
tree | 378b0cdfc49a14d4b26ac1f1171600fe67752428 /sys/src/libdraw/event.c | |
parent | df9597ecde1687ac037101314b477c0f01d3b6a6 (diff) |
libdraw: fix leftover processes or programs failing to restore window labels when receiving interrupt note
fix the default note handler for event programs. only handle non system
notes or notes in the slave processes. for interrupt in the main process,
just call exits() which will do the cleanup and restore window label
properly.
this makes completely overriding the note handler in gping and
stats uneccesary.
Diffstat (limited to 'sys/src/libdraw/event.c')
-rw-r--r-- | sys/src/libdraw/event.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/sys/src/libdraw/event.c b/sys/src/libdraw/event.c index bb4b60179..8b0ad5e64 100644 --- a/sys/src/libdraw/event.c +++ b/sys/src/libdraw/event.c @@ -346,39 +346,33 @@ eforkslave(ulong key) } static int -enote(void *v, char *s) +enote(void*, char *s) { - char t[1]; int i, pid; - USED(v, s); - pid = getpid(); - if(pid != parentpid){ - for(i=0; i<nslave; i++){ - if(pid == eslave[i].pid){ - t[0] = MAXSLAVE; - write(epipe[1], t, 1); - break; - } - } + if(strncmp(s, "sys:", 4) == 0 || strcmp(s, "alarm") == 0) return 0; - } - close(epipe[0]); - epipe[0] = -1; - close(epipe[1]); - epipe[1] = -1; - for(i=0; i<nslave; i++){ + pid = getpid(); + for(i=0; i<nslave; i++) if(pid == eslave[i].pid) - continue; /* don't kill myself */ - postnote(PNPROC, eslave[i].pid, "die"); - } - return 0; + return 1; + if(pid != parentpid) + return 0; + exits("killed"); + return 1; } static void ekill(void) { - enote(0, 0); + int i, pid; + + pid = getpid(); + for(i=0; i<nslave; i++){ + if(pid == eslave[i].pid) + continue; /* don't kill myself */ + postnote(PNPROC, eslave[i].pid, "die"); + } } Mouse |