Blame SOURCES/0001-foomatic-rip-Changed-Ghostscript-call-to-count-pages.patch

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