From 9ae93e34a00bcc2e3f3a8c672443f5d5db177ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= Date: Fri, 6 May 2016 21:08:24 +0200 Subject: [PATCH] Check return value of write_tag() If we were strict, we should check every single fprintf() int write_tag() but it's highly improbable that some of the middle fprintf()s fail and the last one doesn't so the current implementation of write_tag() is probably sufficient. --- tagmanager/src/tm_source_file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tagmanager/src/tm_source_file.c b/tagmanager/src/tm_source_file.c index 28857754..b46ef4e6 100644 --- a/tagmanager/src/tm_source_file.c +++ b/tagmanager/src/tm_source_file.c @@ -576,6 +576,7 @@ gboolean tm_source_file_write_tags_file(const gchar *tags_file, GPtrArray *tags_ { guint i; FILE *fp; + gboolean ret = TRUE; g_return_val_if_fail(tags_array && tags_file, FALSE); @@ -588,13 +589,16 @@ gboolean tm_source_file_write_tags_file(const gchar *tags_file, GPtrArray *tags_ { TMTag *tag = TM_TAG(tags_array->pdata[i]); - write_tag(tag, fp, tm_tag_attr_type_t + ret = write_tag(tag, fp, tm_tag_attr_type_t | tm_tag_attr_scope_t | tm_tag_attr_arglist_t | tm_tag_attr_vartype_t | tm_tag_attr_pointer_t); + + if (!ret) + break; } fclose(fp); - return TRUE; + return ret; } /* add argument list of __init__() Python methods to the class tag */