Blob Blame History Raw
From 422f2a135d904556a441210f16d22e1ee82baa1b Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 8 Aug 2011 11:43:29 +0200
Subject: [PATCH] transfig - rhbz #728825

---
 fig2dev/dev/genpdf.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fig2dev/dev/genpdf.c b/fig2dev/dev/genpdf.c
index 37f4fe4..fe949ce 100644
--- a/fig2dev/dev/genpdf.c
+++ b/fig2dev/dev/genpdf.c
@@ -67,18 +67,21 @@ F_compound	*objects;
 int
 genpdf_end()
 {
+	int	 status;
+
 	/* wrap up the postscript output */
 	if (genps_end() != 0)
 	    return -1;		/* error, return now */
 
-	if (pclose(tfp) != 0) {
+	status = pclose(tfp);
+	/* we've already closed the original output file */
+	tfp = 0;
+	if (status != 0) {
 	    fprintf(stderr,"Error in ghostcript command\n");
 	    fprintf(stderr,"command was: %s\n", gscom);
 	    return -1;
 	}
 	(void) signal(SIGPIPE, SIG_DFL);
-	/* we've already closed the original output file */
-	tfp = 0;
 
 	/* all ok so far */
 
-- 
1.7.4.4