[gs-commits] rev 10895 - trunk/gs/cups

till at ghostscript.com till at ghostscript.com
Tue Mar 9 17:22:35 UTC 2010


Author: till
Date: 2010-03-09 17:22:35 +0000 (Tue, 09 Mar 2010)
New Revision: 10895

Modified:
   trunk/gs/cups/pdftoraster.c
Log:
Let pdftoraster not exit before the Ghostscript sub-process finishes. Thanks to Tim Waugh from Red Hat for the patch.


Modified: trunk/gs/cups/pdftoraster.c
===================================================================
--- trunk/gs/cups/pdftoraster.c	2010-03-09 17:15:22 UTC (rev 10894)
+++ trunk/gs/cups/pdftoraster.c	2010-03-09 17:22:35 UTC (rev 10895)
@@ -35,6 +35,8 @@
 #include <stdarg.h>
 #include <fcntl.h>
 #include <cups/raster.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 #define MAX_CHECK_COMMENT_LINES	20
 #ifndef GS
@@ -123,6 +125,7 @@
   const char* apos;
   int fds[2];
   int pid;
+  int status;
 
   parseOpts(argc, argv);
 
@@ -502,8 +505,17 @@
       }
     }
     fclose(fp);
+    close (fds[1]);
   }
 
-  exit(0);
+  if (waitpid (pid, &status, 0) == -1) {
+    perror (GS);
+    exit (1);
+  }
+
+  if (WIFEXITED (status))
+    exit(WEXITSTATUS (status));
+  else
+    exit(1);
 }
 



More information about the gs-commits mailing list