From f3d30afed75ce5e82ee91fa01de71cb997aa2631 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Fri, 20 Feb 2009 23:58:22 -0300 Subject: [PATCH] Handle the return value to fwrite properly --- girepository/tools/compiler.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/girepository/tools/compiler.c b/girepository/tools/compiler.c index d4de9cdd6..6c6bae632 100644 --- a/girepository/tools/compiler.c +++ b/girepository/tools/compiler.c @@ -96,6 +96,7 @@ write_out_typelib (gchar *prefix, GTypelib *typelib) { FILE *file; + gsize written; if (output == NULL) { @@ -127,7 +128,14 @@ write_out_typelib (gchar *prefix, } if (!code) - fwrite (typelib->data, 1, typelib->len, file); + { + written = fwrite (typelib->data, 1, typelib->len, file); + if (written < typelib->len) { + g_error ("ERROR: Could not write the whole output: %s", + strerror(errno)); + return; + } + } else { gchar *code;