[easytag] Fix log.c unused result warnings, bug 699979



commit bfdfcc879b8d251abbc9a6805e755987ab230fb0
Author: Abhinav <abhijangda hotmail com>
Date:   Thu May 9 19:48:09 2013 +0530

    Fix log.c unused result warnings, bug 699979

 src/log.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/log.c b/src/log.c
index 62dfab2..c8aee7c 100644
--- a/src/log.c
+++ b/src/log.c
@@ -328,7 +328,16 @@ void Log_Print (Log_Error_Type error_type, gchar const *format, ...)
     {
         gchar *time = Log_Format_Date();
         gchar *data = g_strdup_printf("%s %s\n",time,string);
-        fwrite(data,strlen(data),1,file);
+        if (fwrite (data, strlen (data), 1, file) != 1)
+        {
+            //To avoid recursion of Log_Print, using g_critical
+            g_critical ("Error writing to the log file '%s'", file_path);
+            g_free (data);
+            g_free (time);
+            fclose (file);
+            g_free (string);
+            return;
+        }
         g_free(data);
         g_free(time);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]