[easytag/bugfix] g_file_new_tmp error-handling fixup



commit fe11b5193c33b85fd42aabf26b375874bdd8f016
Author: David King <amigadave amigadave com>
Date:   Tue Jan 22 16:12:52 2013 +0000

    g_file_new_tmp error-handling fixup

 src/id3_tag.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/id3_tag.c b/src/id3_tag.c
index 084d53e..7ae06a5 100644
--- a/src/id3_tag.c
+++ b/src/id3_tag.c
@@ -1258,7 +1258,7 @@ gboolean Id3tag_Check_If_File_Is_Corrupted (const gchar *filename)
 gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
 {
     GFile *file;
-    GFileIOStream *ostream;
+    GFileIOStream *ostream = NULL;
     GError *error = NULL;
     guchar tmp[16] = {0xFF, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@@ -1271,20 +1271,20 @@ gboolean Id3tag_Check_If_Id3lib_Is_Bugged (void)
 
     /* Create a temporary file. */
     file = g_file_new_tmp ("easytagXXXXXX.mp3", &ostream, &error);
-    if (file)
+    if (!file)
     {
-        gchar *filename;
-        gchar *filename_utf8;
-
-        filename = g_file_get_path (file);
-        filename_utf8 = filename_to_display (filename);
-        Log_Print (LOG_ERROR, _("Error while opening file: '%s' (%s)"),
-                   filename_utf8, error->message);
-
-        g_free (filename);
-        g_free (filename_utf8);
-        g_clear_error (&error);
-        g_object_unref (file);
+	if (error)
+        {
+            Log_Print (LOG_ERROR,
+                       _("Error while creating temporary file: '%s'"),
+                       error->message);
+            g_clear_error (&error);
+        }
+        else
+        {
+            Log_Print (LOG_ERROR, "%s",
+                       _("Error while creating temporary file"));
+        }
 
         return FALSE;
     }



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