From 94a895c1fa19dfd3c3fcea8538a80fe318db923c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 25 Feb 2014 19:13:58 +0100 Subject: check fwrite return value --- cqrlogo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cqrlogo.c b/cqrlogo.c index d3a9541..6153cb7 100644 --- a/cqrlogo.c +++ b/cqrlogo.c @@ -104,7 +104,10 @@ int main(int argc, char **argv) { } /* write PNG data to stdout */ - fwrite(png->buffer, png->size, 1, stdout); + if (fwrite(png->buffer, png->size, 1, stdout) != 1) { + fprintf(stderr, "Failed writing PNG data to stdout.\n"); + return EXIT_FAILURE; + } /* free memory we no longer need */ if (uri_server_name) -- cgit v1.2.3-70-g09d2