diff options
author | Fazlul Shahriar <fshahriar@gmail.com> | 2019-11-14 00:47:58 -0500 |
---|---|---|
committer | Dan Cross <crossd@gmail.com> | 2019-11-14 01:26:39 -0500 |
commit | 46606276c3fe20fa81597cf87378e18f7baf88a7 (patch) | |
tree | 2e54551c069c4e76cc228b058ccd6ad7c75b7ead /src/cmd/page | |
parent | 436ff26c3688198de8e8e48121296eace0b5d119 (diff) | |
download | plan9port-46606276c3fe20fa81597cf87378e18f7baf88a7.tar.gz plan9port-46606276c3fe20fa81597cf87378e18f7baf88a7.tar.bz2 plan9port-46606276c3fe20fa81597cf87378e18f7baf88a7.zip |
page: fix hang for forward-only postscript files
Page was hanging because ghostscript never closes the fd from which
we're reading BMP data. We close our end of the pipe so that ghostscript
will close its end.
Tested with ghostscript version 9.50.
Fixes #124
Diffstat (limited to 'src/cmd/page')
-rw-r--r-- | src/cmd/page/cache.c | 7 | ||||
-rw-r--r-- | src/cmd/page/ps.c | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/page/cache.c b/src/cmd/page/cache.c index 0063a339..5110840f 100644 --- a/src/cmd/page/cache.c +++ b/src/cmd/page/cache.c @@ -168,7 +168,12 @@ raproc(void *a) c = a; lockdisplay(display); - _cachedpage(c->doc, c->angle, c->page, "-ra"); + /* + * If there is only one page in a fwdonly file, we may reach EOF + * while doing readahead and page will exit without showing anything. + */ + if(!c->doc->fwdonly) + _cachedpage(c->doc, c->angle, c->page, "-ra"); rabusy = 0; unlockdisplay(display); free(c); diff --git a/src/cmd/page/ps.c b/src/cmd/page/ps.c index 7935f694..84689571 100644 --- a/src/cmd/page/ps.c +++ b/src/cmd/page/ps.c @@ -355,6 +355,7 @@ Keepreading: if(dumb) { fprint(ps->gs.gsfd, "(%s) run PAGEFLUSH\n", argv[0]); fprint(ps->gs.gsfd, "(/dev/fd/3) (w) file dup (THIS IS NOT A PLAN9 BITMAP 01234567890123456789012345678901234567890123456789\\n) writestring flushfile\n"); + close(ps->gs.gsfd); } ps->bbox = bbox; |