From 8bedfb6eb45f75f22c0887adaa3d2e648247bff7 Mon Sep 17 00:00:00 2001 From: Ian Rees Date: Mon, 5 Oct 2020 16:37:04 +1300 Subject: [PATCH] Don't close output file after writing first graph Fixes #1845, essentially by reverting 806b8a2f --- cmd/dot/dot.c | 2 +- lib/gvc/gvdevice.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/dot/dot.c b/cmd/dot/dot.c index 631448663..445fefb6b 100644 --- a/cmd/dot/dot.c +++ b/cmd/dot/dot.c @@ -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)); } diff --git a/lib/gvc/gvdevice.c b/lib/gvc/gvdevice.c index 0a9951186..03a348d02 100644 --- a/lib/gvc/gvdevice.c +++ b/lib/gvc/gvdevice.c @@ -46,6 +46,7 @@ static unsigned int dfallocated; static uint64_t crc; #endif /* HAVE_LIBZ */ +#include #include #include #include @@ -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; } -- 2.40.0