$NetBSD: patch-ac,v 1.4 2013/04/10 15:34:02 drochner Exp $

--- foomaticrip.c.orig	2012-07-02 14:50:46.000000000 +0000
+++ foomaticrip.c
@@ -180,7 +180,7 @@ char cupsfilterpath[PATH_MAX] = "/usr/lo
                                 "/opt/cups/filter:"
                                 "/usr/lib/cups/filter";
 
-char modern_shell[64] = "/bin/bash";
+char modern_shell[64] = "/bin/sh";
 
 void config_set_option(const char *key, const char *value)
 {
@@ -1014,7 +1014,7 @@ int print_file(const char *filename, int
 
             if (!ppd_supports_pdf())
             {
-                char pdf2ps_cmd[PATH_MAX];
+                char pdf2ps_cmd[FM_CMDLINE_MAX];
                 FILE *out, *in;
                 int renderer_pid;
 		char tmpfilename[PATH_MAX] = "";
@@ -1060,12 +1060,12 @@ int print_file(const char *filename, int
 		   We give priority to Ghostscript here and use Poppler if
 		   Ghostscript is not available. */
 		if (spooler == SPOOLER_CUPS)
-		  snprintf(pdf2ps_cmd, PATH_MAX,
+		  snprintf(pdf2ps_cmd, FM_CMDLINE_MAX,
 			   "pdftops '%s' '%s' '%s' '%s' '%s' '%s'",
 			   job->id, job->user, job->title, "1", job->optstr->data,
 			   filename);
 		else
-		  snprintf(pdf2ps_cmd, PATH_MAX,
+		  snprintf(pdf2ps_cmd, FM_CMDLINE_MAX,
 			   "gs -q -sstdout=%%stderr -sDEVICE=ps2write -sOutputFile=- "
 			   "-dBATCH -dNOPAUSE -dPARANOIDSAFER -dNOINTERPOLATE %s 2>/dev/null || "
 			   "pdftops -level2 -origpagesizes %s - 2>/dev/null",
@@ -1076,6 +1076,7 @@ int print_file(const char *filename, int
                 if (dup2(fileno(out), fileno(stdin)) < 0)
                     rip_die(EXIT_PRNERR_NORETRY_BAD_SETTINGS,
                             "Couldn't dup stdout of pdf-to-ps\n");
+		rewind(stdin);
 
                 ret = print_file("<STDIN>", 0);
 
@@ -1107,6 +1108,7 @@ int print_file(const char *filename, int
             /* Read further data from the file converter and not from STDIN */
             if (dup2(fileno(fchandle), fileno(stdin)) < 0)
                 rip_die(EXIT_PRNERR_NORETRY_BAD_SETTINGS, "Couldn't dup fileconverterhandle\n");
+	    rewind(stdin);
 
             ret = print_file("<STDIN>", 0);
 
