]> granicus.if.org Git - graphviz/commitdiff
Don't close output file after writing first graph
authorIan Rees <ian.rees@gmail.com>
Mon, 5 Oct 2020 03:37:04 +0000 (16:37 +1300)
committerIan Rees <ian.rees@gmail.com>
Mon, 5 Oct 2020 03:37:04 +0000 (16:37 +1300)
Fixes #1845, essentially by reverting 806b8a2f

cmd/dot/dot.c
lib/gvc/gvdevice.c

index 631448663307c0991d4f66182767f07078c99dba..445fefb6b81545ff8edc756c9682b602a2a20a72 100644 (file)
@@ -131,12 +131,12 @@ int main(int argc, char **argv)
            }
            gvLayoutJobs(Gvc, G);  /* take layout engine from command line */
            gvRenderJobs(Gvc, G);
-            gvFinalize(Gvc);
            r = agreseterrors();
            rc = MAX(rc,r);
            prev = G;
        }
     }
+    gvFinalize(Gvc);
     r = gvFreeContext(Gvc);
     return (MAX(rc,r));
 }
index 0a995118677c295864fdd0219e7df76fb6c25c91..03a348d0261e88bf8025737c08fd26371dc0cc69 100644 (file)
@@ -46,6 +46,7 @@ static unsigned int dfallocated;
 static uint64_t crc;
 #endif /* HAVE_LIBZ */
 
+#include <assert.h>
 #include <common/const.h>
 #include <common/memory.h>
 #include <gvc/gvplugin_device.h>
@@ -76,8 +77,10 @@ static size_t gvwrite_no_z (GVJ_t * job, const char *s, size_t len)
        job->output_data[job->output_data_position] = '\0'; /* keep null termnated */
        return len;
     }
-    else
-       return fwrite(s, sizeof(char), len, job->output_file);
+    else {
+        assert(job->output_file != NULL);
+        return fwrite(s, sizeof(char), len, job->output_file);
+    }
     return 0;
 }