From 6349ccc97b93abc1e0023c2af5b8f50c0491d7f9 Mon Sep 17 00:00:00 2001 From: Simon Levermann Date: Wed, 7 Aug 2013 13:13:04 +0200 Subject: [PATCH 1/2] Don't ignore the result of fwrite. Since we're building with -Wall and -Werror, this causes compile failures. --- testing/Messenger_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 0518d284..ad86184d 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) if ( file==NULL ){return 1;} uint8_t * buffer = malloc(Messenger_size()); Messenger_save(buffer); - fwrite(buffer, 1, Messenger_size(), file); + size_t write_result = fwrite(buffer, 1, Messenger_size(), file); free(buffer); fclose(file); } From 924219b1abf542eabc6740570436640382c82a39 Mon Sep 17 00:00:00 2001 From: Simon Levermann Date: Wed, 7 Aug 2013 13:23:12 +0200 Subject: [PATCH 2/2] Actually use write_result --- testing/Messenger_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index ad86184d..24a78abb 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c @@ -139,6 +139,7 @@ int main(int argc, char *argv[]) uint8_t * buffer = malloc(Messenger_size()); Messenger_save(buffer); size_t write_result = fwrite(buffer, 1, Messenger_size(), file); + if (write_result < Messenger_size()) {return 1;} free(buffer); fclose(file); }