Handle the return value to fwrite properly

This commit is contained in:
Johan Dahlin 2009-02-20 23:58:22 -03:00 committed by Evan Welsh
parent 4dd500c22a
commit f3d30afed7

View File

@ -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;