Blame SOURCES/0001-foomatic-rip-Changed-Ghostscript-call-to-count-pages.patch
|
|
2508af |
diff --git a/foomaticrip.h b/foomaticrip.h
|
|
|
2508af |
index 2777672..fea8e47 100644
|
|
|
2508af |
--- a/foomaticrip.h
|
|
|
2508af |
+++ b/foomaticrip.h
|
|
|
2508af |
@@ -94,6 +94,7 @@ extern int spooler;
|
|
|
2508af |
|
|
|
2508af |
|
|
|
2508af |
#define PATH_MAX 65536
|
|
|
2508af |
+#define CMDLINE_MAX 65536
|
|
|
2508af |
|
|
|
2508af |
typedef struct {
|
|
|
2508af |
char printer[256];
|
|
|
2508af |
diff --git a/pdf.c b/pdf.c
|
|
|
2508af |
index ebd6ab5..ee4eb51 100644
|
|
|
2508af |
--- a/pdf.c
|
|
|
2508af |
+++ b/pdf.c
|
|
|
2508af |
@@ -41,14 +41,13 @@ static int wait_for_renderer();
|
|
|
2508af |
|
|
|
2508af |
static int pdf_count_pages(const char *filename)
|
|
|
2508af |
{
|
|
|
2508af |
- char gscommand[4095];
|
|
|
2508af |
+ char gscommand[CMDLINE_MAX];
|
|
|
2508af |
char output[31] = "";
|
|
|
2508af |
int pagecount;
|
|
|
2508af |
|
|
|
2508af |
- snprintf(gscommand, 4095, "%s -dNODISPLAY -q -c "
|
|
|
2508af |
- "'/pdffile (%s) (r) file def pdfdict begin pdffile pdfopen begin "
|
|
|
2508af |
- "(PageCount: ) print pdfpagecount == flush currentdict pdfclose "
|
|
|
2508af |
- "end end quit'",
|
|
|
2508af |
+ snprintf(gscommand, CMDLINE_MAX, "%s -dNODISPLAY -q -c "
|
|
|
2508af |
+ "'/pdffile (%s) (r) file runpdfbegin (PageCount: ) print "
|
|
|
2508af |
+ "pdfpagecount = quit'",
|
|
|
2508af |
gspath, filename);
|
|
|
2508af |
|
|
|
2508af |
FILE *pd = popen(gscommand, "r");
|