]> spindle.queued.net Git - midori/commitdiff
Arrange file saving for error handling to fix warnings
authorBrian Vuyk <brian@brianvuyk.com>
Sat, 15 Nov 2008 23:10:39 +0000 (00:10 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 15 Nov 2008 23:10:39 +0000 (00:10 +0100)
katze/katze-net.c
midori/midori-browser.c

index 9b81a38d1f6c4d73542aa7c8838767995e960f62..9fa651e259ef2e4e7f1ba0067a2b3049e2dbf471 100644 (file)
@@ -419,6 +419,7 @@ katze_net_icon_transfer_cb (KatzeNetRequest*  request,
     FILE* fp;
     GdkPixbuf* pixbuf_scaled;
     gint icon_width, icon_height;
+    size_t ret;
 
     if (request->status == KATZE_NET_MOVED)
         return;
@@ -428,8 +429,13 @@ katze_net_icon_transfer_cb (KatzeNetRequest*  request,
     {
         if ((fp = fopen (priv->icon_file, "wb")))
         {
-            fwrite (request->data, 1, request->length, fp);
+            ret = fwrite (request->data, 1, request->length, fp);
             fclose (fp);
+            if ((ret - request->length) != 0)
+            {
+                /*  FIXME: We need error handling. If this is called,
+                    it means there was a write error */
+            }
             pixbuf = gdk_pixbuf_new_from_file (priv->icon_file, NULL);
         }
         else
index 68ecac19b6539301a9488fe6419ef11899fa6c5c..221ba366f66f97cdea9dd8a577c5e38e07da9033 100644 (file)
@@ -635,14 +635,20 @@ midori_browser_save_transfer_cb (KatzeNetRequest* request,
                                  gchar*           filename)
 {
     FILE* fp;
+    size_t ret;
 
     if (request->data)
     {
         /* FIXME: Show an error message if the file cannot be saved */
         if ((fp = fopen (filename, "wb")))
         {
-            fwrite (request->data, 1, request->length, fp);
+            ret = fwrite (request->data, 1, request->length, fp);
             fclose (fp);
+            if ((ret - request->length) != 0)
+            {
+                /*  FIXME: We need error handling. If this is called,
+                    i means there was a write error */
+            }
         }
     }
     g_free (filename);
@@ -1822,6 +1828,7 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
     gchar* text_editor;
     gint fd;
     FILE* fp;
+    size_t ret;
 
     if (request->data)
     {
@@ -1833,8 +1840,13 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
         {
             if ((fp = fdopen (fd, "w")))
             {
-                fwrite (request->data, 1, request->length, fp);
+                ret = fwrite (request->data, 1, request->length, fp);
                 fclose (fp);
+                if ((ret - request->length) != 0)
+                {
+                    /*  FIXME: We need error handling. If this is called,
+                        it means there was a write error */
+                }
                 g_object_get (browser->settings,
                     "text-editor", &text_editor, NULL);
                 sokoke_spawn_program (text_editor, unique_filename);