[evince] [comics] Correct check for exit status



commit 0da7f82a8a347f47809b4f9553555b18323089d9
Author: Juanjo Marín <juanj marin juntadeandalucia es>
Date:   Sun Apr 26 14:30:49 2009 +0400

    [comics] Correct check for exit status
    
    Status of the dvipdfm needs to be checked after exit. Fixes
    GNOME bug #579656.
---
 backend/comics/comics-document.c |    4 +++-
 backend/dvi/dvi-document.c       |    6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index dc5a8b0..7d450d0 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -24,6 +24,8 @@
 #include <string.h>
 #include <glib/gi18n-lib.h>
 #include <gio/gio.h>
+#include <sys/wait.h>
+#include <stdlib.h>
 
 #include "comics-document.h"
 #include "ev-document-misc.h"
@@ -179,7 +181,7 @@ comics_document_load (EvDocument *document,
 
 	if (!success) {
 		return FALSE;
-	} else if (retval != 0) {
+	} else if (!WIFEXITED(retval) || WEXITSTATUS(retval) != EXIT_SUCCESS) {
 		g_set_error_literal (error,
                                      EV_DOCUMENT_ERROR,
                                      EV_DOCUMENT_ERROR_INVALID,
diff --git a/backend/dvi/dvi-document.c b/backend/dvi/dvi-document.c
index a6c3340..a1097c9 100644
--- a/backend/dvi/dvi-document.c
+++ b/backend/dvi/dvi-document.c
@@ -32,6 +32,8 @@
 
 #include <glib/gi18n-lib.h>
 #include <ctype.h>
+#include <sys/wait.h>
+#include <stdlib.h>
 
 GMutex *dvi_context_mutex = NULL;
 
@@ -398,8 +400,8 @@ dvi_document_file_exporter_end (EvFileExporter *exporter)
 
 	if (success == FALSE) {
 		g_warning ("Error: %s", err->message);
-	} else if (exit_stat != 0) {
-		g_warning ("Error: dvipdfm exited with non-zero status.");
+	} else if (!WIFEXITED(exit_stat) || WEXITSTATUS(exit_stat) != EXIT_SUCCESS){
+		g_warning ("Error: dvipdfm does not end normally or exit with a failure status.");
 	}
 
 	if (err)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]