diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-02-11 13:40:11 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-02-11 13:40:11 +0100 |
commit | 9c79e48c93c0c4d14aabcb490fab048d68934cb2 (patch) | |
tree | 1d57d3fd193621a2357473bb65b92190914c5736 /src/libdraw | |
parent | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (diff) | |
parent | 0237dec768a4ee36ae9e18ce8566d2c999d78410 (diff) | |
download | plan9port-9c79e48c93c0c4d14aabcb490fab048d68934cb2.tar.gz plan9port-9c79e48c93c0c4d14aabcb490fab048d68934cb2.tar.bz2 plan9port-9c79e48c93c0c4d14aabcb490fab048d68934cb2.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/libdraw')
-rw-r--r-- | src/libdraw/getsubfont.c | 22 | ||||
-rw-r--r-- | src/libdraw/mouse.c | 6 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/libdraw/getsubfont.c b/src/libdraw/getsubfont.c index ec4ccfe3..1cc234ef 100644 --- a/src/libdraw/getsubfont.c +++ b/src/libdraw/getsubfont.c @@ -53,15 +53,25 @@ _getsubfont(Display *d, char *name) static int defaultpipe(void) { - int p[2]; + int p[2], pid; - // assuming defontdata (<5k) fits in pipe buffer. - // especially reasonable since p9pipe is actually - // a socket pair. + // Used to assume that defontdata (<5k) fit in the + // pipe buffer, especially since p9pipe is actually + // a socket pair. But OpenBSD in particular saw hangs, + // so feed the pipe it the "right" way with a subprocess. if(pipe(p) < 0) return -1; - write(p[1], defontdata, sizeof defontdata); - close(p[1]); + if((pid = fork()) < 0) { + close(p[0]); + close(p[1]); + return -1; + } + if(pid == 0) { + close(p[0]); + write(p[1], defontdata, sizeof defontdata); + close(p[1]); + _exit(0); + } return p[0]; } diff --git a/src/libdraw/mouse.c b/src/libdraw/mouse.c index 64a7f73d..382efae5 100644 --- a/src/libdraw/mouse.c +++ b/src/libdraw/mouse.c @@ -52,8 +52,12 @@ _ioproc(void *arg) one = 1; resized = 0; for(;;){ - if(_displayrdmouse(mc->display, &m, &resized) < 0) + if(_displayrdmouse(mc->display, &m, &resized) < 0) { + if(postnote(PNPROC, getpid(), "hangup") < 0) + fprint(2, "postnote: %r\n"); + sleep(10*1000); threadexitsall("mouse read error"); + } if(resized) send(mc->resizec, &one); send(mc->c, &m); |