From a31e562fd489e0ea515caea13979a64d871be9b5 Mon Sep 17 00:00:00 2001 From: Harald Oehlmann Date: Mon, 7 Dec 2015 22:41:40 +0100 Subject: [PATCH] "Fix stdout handling for png output", 2012-08-06 from https://github.com/zint/zint/commit/fdb8b4e30e6a5a109a0a72cc664936ff1f7fe5cb --- backend/png.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/png.c b/backend/png.c index 7f83237f..84c19c26 100644 --- a/backend/png.c +++ b/backend/png.c @@ -307,7 +307,11 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width /* make sure we have disengaged */ if (png_ptr && info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); - fclose(wpng_info.outfile); + if(symbol->output_options & BARCODE_STDOUT) { + fflush(wpng_info.outfile); + } else { + fclose(wpng_info.outfile); + } return 0; } #endif /* NO_PNG */