about summary refs log tree commit diff
path: root/converter/other/pngx.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/pngx.c')
-rw-r--r--converter/other/pngx.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/converter/other/pngx.c b/converter/other/pngx.c
index 7840b2da..c8703443 100644
--- a/converter/other/pngx.c
+++ b/converter/other/pngx.c
@@ -1,6 +1,10 @@
 #include <stdbool.h>
 #include <assert.h>
 #include <png.h>
+/* Because of a design error in png.h, you must not #include <setjmp.h> before
+   <png.h>.  If you do, png.h won't compile.
+*/
+#include <setjmp.h>
 #include "pm_c_util.h"
 #include "mallocvar.h"
 #include "nstring.h"
@@ -34,16 +38,14 @@ errorHandler(png_structp     const png_ptr,
        been defined.
     */
 
-    pm_message("fatal libpng error: %s", msg);
+    pm_errormsg("fatal libpng error: %s", msg);
 
     jmpbufP = png_get_error_ptr(png_ptr);
 
-    if (!jmpbufP) {
-        /* we are completely hosed now */
-        pm_error("EXTREMELY fatal error: jmpbuf unrecoverable; terminating.");
-    }
-
-    longjmp(*jmpbufP, 1);
+    if (!jmpbufP)
+        pm_longjmp();
+    else
+        longjmp(*jmpbufP, 1);
 }