]> spindle.queued.net Git - midori/commitdiff
Take soup status message into account in finish callback of web cache
authorAlexander Butenko <a.butenka@gmail.com>
Mon, 23 Nov 2009 19:42:22 +0000 (20:42 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 23 Nov 2009 19:42:22 +0000 (20:42 +0100)
extensions/web-cache.c

index 74b1691ce54198580536baab15ef2830598d20a1..f669b8e6a893eda5266a67185c7c9349290b1474 100644 (file)
@@ -226,8 +226,16 @@ web_cache_message_finished_cb (SoupMessage* msg,
     tmp_headers = g_strdup_printf ("%s.dsc.tmp", filename);
     tmp_data = g_strdup_printf ("%s.tmp", filename);
 
-    g_rename (tmp_data, filename);
-    g_rename (tmp_headers, headers);
+    if (msg->status_code == SOUP_STATUS_OK)
+    {
+        g_rename (tmp_data, filename);
+        g_rename (tmp_headers, headers);
+    }
+    else
+    {
+        g_unlink (tmp_data);
+        g_unlink (tmp_headers);
+    }
 
     g_free (headers);
     g_free (tmp_headers);