freebsd-ports/graphics/peps/files/patch-peps.c
Joseph Koshy cf8e9ef60b Add a patch that makes PEPS check the exit status of the 'gs' pipeline
that it invokes.  This allows a faulty EPS file to stop a documentation
build rather than silently produce corrupted images.

Bump PORTREVISION.

Approved by:	petef [MAINTAINER]
2003-06-17 01:31:54 +00:00

37 lines
587 B
C

--- peps.c- Thu Jul 5 05:29:56 2001
+++ peps.c Mon Jun 16 15:13:13 2003
@@ -62,6 +62,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
+#include <sys/wait.h>
char gsargs[] = "gs "
"-q "
@@ -181,7 +182,8 @@
}
int main(int argc, char *argv[]) {
- register int i;
+ register int i;
+ int status, error;
register char *charptr;
FILE *gs, *eps;
@@ -420,8 +422,14 @@
input, input
);
- pclose(gs);
+ status = pclose(gs);
- return 0;
+ error = !WIFEXITED(status) || WEXITSTATUS(status);
+
+ if (error && output)
+ (void) remove(output);
+
+ exit(error);
+
}