Blame SOURCES/netpbm-multipage-pam.patch

1ab173
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c
1ab173
index 24dc7df..e393931 100644
1ab173
--- a/converter/other/pnmtops.c
1ab173
+++ b/converter/other/pnmtops.c
1ab173
@@ -1909,6 +1909,7 @@ convertPage(FILE *       const ifP,
1ab173
         /* The file stream which is the head of the filter chain; we write to
1ab173
            this and filtered stuff comes out the other end.
1ab173
         */
1ab173
+    FILE * filterChainOfP;
1ab173
 
1ab173
     pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
1ab173
 
1ab173
@@ -1951,7 +1952,11 @@ convertPage(FILE *       const ifP,
1ab173
     initOutputEncoder(&oe, inpam.width, bitsPerSample,
1ab173
                       rle, flate, ascii85, psFilter);
1ab173
 
1ab173
-    spawnFilters(stdout, &oe, &feedFileP, filterPidList);
1ab173
+    fflush(stdout);
1ab173
+    filterChainOfP = fdopen(dup(fileno(stdout)), "w");
1ab173
+        /* spawnFilters() closes this. See FILE MANAGEMENT above */
1ab173
+
1ab173
+    spawnFilters(filterChainOfP, &oe, &feedFileP, filterPidList);
1ab173
  
1ab173
     convertRaster(&inpam, bitsPerSample, psFilter, feedFileP);
1ab173