src/lib/cache.c
changeset 8 400ddf1e7aa9
parent 7 997906f5fd2d
child 9 a31048ff76a2
--- a/src/lib/cache.c	Mon Dec 28 22:50:00 2009 +0200
+++ b/src/lib/cache.c	Mon Dec 28 23:15:18 2009 +0200
@@ -55,7 +55,7 @@
     return 0;
 }
 
-int pt_cache_stale (struct pt_cache *cache, const char *img_path)
+int pt_cache_status (struct pt_cache *cache, const char *img_path)
 {
     struct stat st_img, st_cache;
     
@@ -67,13 +67,17 @@
     if (stat(cache->path, &st_cache) < 0) {
         // always stale if it doesn't exist yet
         if (errno == ENOENT)
-            return 1;
+            return PT_CACHE_NONE;
         else
             return -1;
     }
 
     // compare mtime
-    return (st_img.st_mtime > st_cache.st_mtime);
+    if (st_img.st_mtime > st_cache.st_mtime)
+        return PT_CACHE_STALE;
+
+    else
+        return PT_CACHE_FRESH;
 }
 
 /**