blob: cf48f34ee7e575febd063d42b072d9ae4afe7c5c [file] [log] [blame]
From: Pranav Batra <batrapranav@chromium.org>
Subject: [PATCH] Fix raw printing infinite loop and file input.
--- a/filter/foomatic-rip/foomaticrip.c
+++ b/filter/foomatic-rip/foomaticrip.c
@@ -1157,7 +1157,18 @@ int main(int argc, char** argv)
when there is no postpipe) */
_log("Raw printing, executing \"cat %%s\"\n\n");
snprintf(tmp, 1024, "cat %s", postpipe->data);
+ if (strcasecmp(filename, "<STDIN>")) {
+ FILE *fh = fopen(filename, "r");
+ if (!fh) {
+ _log("Failed to open \"%s\".\n", filename);
+ fclose(stdin);
+ } else {
+ dup2(fileno(fh), 0);
+ fclose(fh);
+ }
+ }
run_system_process("raw-printer", tmp);
+ filename = strtok_r(NULL, " ", &p);
continue;
}