From cbf01be4126cbc0f6d80364a7e0b6ad777a7d8ae Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 9 Oct 2021 13:44:31 -0400 Subject: Fix handling of deferred write errors that happen when closing --- tools/console.c | 6 ++++-- tools/serd-filter.c | 2 +- tools/serd-pipe.c | 2 +- tools/serd-sort.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/console.c b/tools/console.c index 3b209273..c6e55c17 100644 --- a/tools/console.c +++ b/tools/console.c @@ -372,8 +372,10 @@ serd_open_tool_output(const char* const filename) { if (!filename || !strcmp(filename, "-")) { serd_set_stream_utf8_mode(stdout); - return serd_open_output_stream( - (SerdWriteFunc)fwrite, (SerdCloseFunc)fclose, stdout); + return serd_open_output_stream((SerdWriteFunc)fwrite, + (SerdErrorFunc)ferror, + (SerdCloseFunc)fclose, + stdout); } return serd_open_output_file(filename); diff --git a/tools/serd-filter.c b/tools/serd-filter.c index 0804d6ba..b172d05d 100644 --- a/tools/serd-filter.c +++ b/tools/serd-filter.c @@ -127,7 +127,7 @@ log_error(SerdWorld* const world, const char* const fmt, ...) static SerdStatus run(Options opts) { - SerdTool app = {{NULL, NULL, NULL}, NULL, NULL, NULL}; + SerdTool app = {{NULL, NULL, NULL, NULL}, NULL, NULL, NULL}; // Set up the writing environment SerdStatus st = SERD_SUCCESS; diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c index f2891f9b..612826ca 100644 --- a/tools/serd-pipe.c +++ b/tools/serd-pipe.c @@ -39,7 +39,7 @@ typedef struct { static SerdStatus run(const Options opts) { - SerdTool app = {{NULL, NULL, NULL}, NULL, NULL, NULL}; + SerdTool app = {{NULL, NULL, NULL, NULL}, NULL, NULL, NULL}; // Set up the writing environment SerdStatus st = SERD_SUCCESS; diff --git a/tools/serd-sort.c b/tools/serd-sort.c index 7219fa26..267e75f8 100644 --- a/tools/serd-sort.c +++ b/tools/serd-sort.c @@ -57,7 +57,7 @@ input_has_graphs(const Options opts) static SerdStatus run(const Options opts) { - SerdTool app = {{NULL, NULL, NULL}, NULL, NULL, NULL}; + SerdTool app = {{NULL, NULL, NULL, NULL}, NULL, NULL, NULL}; // Set up the writing environment SerdStatus st = SERD_SUCCESS; -- cgit v1.2.1