examples/vcard: fix warn_unused_result related to fwrite()
This commit is contained in:
@@ -36,6 +36,7 @@ static void vcard_photo(vcard_t *vc, xmpp_stanza_t *stanza)
|
|||||||
char *copy;
|
char *copy;
|
||||||
unsigned char *img;
|
unsigned char *img;
|
||||||
size_t img_size;
|
size_t img_size;
|
||||||
|
size_t written;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
|
||||||
tmp = xmpp_stanza_get_child_by_name(stanza, "TYPE");
|
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");
|
fd = fopen(vc->img_path, "w");
|
||||||
assert(fd != NULL);
|
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);
|
fclose(fd);
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
|
|||||||
Reference in New Issue
Block a user