diff options
author | Russ Cox <rsc@swtch.com> | 2011-10-25 12:55:09 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2011-10-25 12:55:09 -0400 |
commit | c383979b0128640f4c658acdd0a383430b49f1da (patch) | |
tree | 8907db951cb6a7d4e08fd90ab1b757c4d36eeceb /src/cmd/page | |
parent | b4d0ac961262aace74431d78fe952a404a6f25a1 (diff) | |
download | plan9port-c383979b0128640f4c658acdd0a383430b49f1da.tar.gz plan9port-c383979b0128640f4c658acdd0a383430b49f1da.tar.bz2 plan9port-c383979b0128640f4c658acdd0a383430b49f1da.zip |
page: check for gs failure
Diffstat (limited to 'src/cmd/page')
-rw-r--r-- | src/cmd/page/pdf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/page/pdf.c b/src/cmd/page/pdf.c index cf6ecf90..2de67bc7 100644 --- a/src/cmd/page/pdf.c +++ b/src/cmd/page/pdf.c @@ -103,6 +103,14 @@ initpdf(Biobuf *b, int argc, char **argv, uchar *buf, int nbuf) gscmd(&pdf->gs, "(%s) (r) file { DELAYSAFER { .setsafe } if } stopped pop pdfopen begin\n", fn); gscmd(&pdf->gs, "pdfpagecount PAGE==\n"); p = Brdline(&pdf->gs.gsrd, '\n'); + if(p == nil) { + if(Blinelen(&pdf->gs.gsrd) > 0) { + fprint(2, "unexpected output (too long) from gs\n"); + return nil; + } + fprint(2, "early EOF from gs - is ghostscript installed?\n"); + return nil; + } npage = atoi(p); if(npage < 1) { fprint(2, "no pages?\n"); |