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



commit 96f2700578ab143214221de2c7762a9c9be0a167
Author: Abhinav <abhijangda hotmail com>
Date:   Thu May 9 23:13:42 2013 +0530

    Fix setting.c unused result warnings, bug 699979
    
    Additionally, fix build error in previous patch.

 src/id3v24_tag.c |    1 +
 src/setting.c    |   42 +++++++++++++++++++++++++++++++++++-------
 2 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index 8e5bcb2..7bceb4d 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -1487,6 +1487,7 @@ etag_write_tags (const gchar *filename,
         {
             if (write (fd, v2buf, v2size) != v2size)
             {
+                gchar *filename_utf8 = filename_to_display (filename);
                 gchar *basename_utf8 = g_path_get_basename (filename_utf8);
                 Log_Print (LOG_ERROR, _("Cannot save tag of file '%s'"),
                            basename_utf8);
diff --git a/src/setting.c b/src/setting.c
index 9537a1e..3931a0c 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -935,8 +935,15 @@ Save_Config_To_File (void)
                 {
                     data = g_strdup_printf("%s=%i\n",Config_Variables[i].name,
                                                      *(int *)Config_Variables[i].pointer);
-                    fwrite(data,strlen(data),1,file);
-                    //g_print("# (type:%d) %s",Config_Variables[i].type,data);
+                    if (fwrite (data, strlen (data), 1, file) != 1)
+                    {
+                        Log_Print (LOG_ERROR,
+                                   _("Error while writing configuration file: %s"),
+                                   file_path);
+                        fclose (file);
+                        g_free (file_path);
+                        return;
+                    }
                     g_free(data);
                     break;
                 }
@@ -944,8 +951,15 @@ Save_Config_To_File (void)
                 {
                     data = g_strdup_printf("%s=%i\n",Config_Variables[i].name,
                                                      ( *(int *)Config_Variables[i].pointer ? 1 : 0 ));
-                    fwrite(data,strlen(data),1,file);
-                    //g_print("# (type:%d) %s",Config_Variables[i].type,data);
+                    if (fwrite (data, strlen (data), 1, file) != 1)
+                    {
+                        Log_Print (LOG_ERROR,
+                                   _("Error while writing configuration file: %s"),
+                                   file_path);
+                        fclose (file);
+                        g_free (file_path);
+                        return;
+                    }
                     g_free(data);
                     break;
                 }
@@ -956,8 +970,15 @@ Save_Config_To_File (void)
 
                     data = g_strdup_printf("%s=%s\n",Config_Variables[i].name,
                                                      *(char **)Config_Variables[i].pointer);
-                    fwrite(data,strlen(data),1,file);
-                    //g_print("# (type:%d) %s",Config_Variables[i].type,data);
+                    if (fwrite (data, strlen (data), 1, file) != 1)
+                    {
+                        Log_Print (LOG_ERROR,
+                                   _("Error while writing configuration file: %s"),
+                                   file_path);
+                        fclose (file);
+                        g_free (file_path);
+                        return;
+                    }
                     g_free(data);
                     break;
                 }
@@ -1176,7 +1197,14 @@ Save_List_Store_To_File (const gchar *filename, GtkListStore *liststore, gint co
 
             if (data)
             {
-                fwrite(data,strlen(data),1,file);
+                if (fwrite (data, strlen (data), 1, file))
+                {
+                    Log_Print (LOG_ERROR, _("Error while writing list file: %s"),
+                               file_path);
+                    fclose (file);
+                    g_free (file_path);
+                    return;
+                }
                 g_free(data);
             }
         } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(liststore), &iter));


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