[Xfce4-commits] <midori:master> Adblock: handle files with dates in future

Christian Dywan noreply at xfce.org
Tue Sep 11 00:46:03 CEST 2012


Updating branch refs/heads/master
         to 419d4c1ae588252357ab75c09956f8878579771c (commit)
       from 82242a8c2e74c788e5cae9085c64d1ed31e3078b (commit)

commit 419d4c1ae588252357ab75c09956f8878579771c
Author: Paweł Forysiuk <tuxator at o2.pl>
Date:   Thu Sep 6 00:00:46 2012 +0200

    Adblock: handle files with dates in future

 extensions/adblock.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/extensions/adblock.c b/extensions/adblock.c
index 91855da..e6608e7 100644
--- a/extensions/adblock.c
+++ b/extensions/adblock.c
@@ -1544,7 +1544,7 @@ adblock_file_is_up_to_date (gchar* path)
     /* Check a chunk of header for update info */
     if ((file = g_fopen (path, "r")))
     {
-        guint days_to_expire = 0;
+        gint days_to_expire = 0;
         gchar* timestamp = NULL;
         guint i;
         gboolean found_meta = FALSE;
@@ -1591,7 +1591,7 @@ adblock_file_is_up_to_date (gchar* path)
 
         if (days_to_expire && timestamp != NULL)
         {
-            guint days_elapsed = 0;
+            gint days_elapsed = 0;
 
             GDate* current = g_date_new ();
             GDate* mod_date = g_date_new ();
@@ -1624,6 +1624,14 @@ adblock_file_is_up_to_date (gchar* path)
             g_date_free (mod_date);
             g_free (timestamp);
 
+            /* File from the future? Assume up to date, not to loop */
+            if (days_elapsed < 0)
+            {
+                g_print ("Adblock: file %s appears to be from the future,"
+                         "check your system clock!\n", path);
+                return TRUE;
+            }
+
             if (days_elapsed < days_to_expire)
                 return TRUE;
             else


More information about the Xfce4-commits mailing list