From 0bdb5f1d5b2410468de5b375644b06fb756a1786 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Thu, 29 Jun 2017 18:32:17 +0300 Subject: [PATCH] examples/vcard: fix warn_unused_result related to fwrite() --- examples/vcard.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/vcard.c b/examples/vcard.c index b84d25e..47d3d4c 100644 --- a/examples/vcard.c +++ b/examples/vcard.c @@ -36,6 +36,7 @@ static void vcard_photo(vcard_t *vc, xmpp_stanza_t *stanza) char *copy; unsigned char *img; size_t img_size; + size_t written; FILE *fd; tmp = xmpp_stanza_get_child_by_name(stanza, "TYPE"); @@ -65,7 +66,9 @@ static void vcard_photo(vcard_t *vc, xmpp_stanza_t *stanza) fd = fopen(vc->img_path, "w"); assert(fd != NULL); - fwrite(img, 1, img_size, fd); + written = fwrite(img, 1, img_size, fd); + if (written < img_size) + printf("Saving photo failed\n"); fclose(fd); free(copy);