]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
probe.c (blkid_verify_devname): If the time is earlier than the
authorTheodore Ts'o <tytso@mit.edu>
Tue, 20 Apr 2004 01:42:18 +0000 (21:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Apr 2004 01:42:18 +0000 (21:42 -0400)
last modified time of the device, then force a reverify;
it means the system time may not be trustworthy.

lib/blkid/ChangeLog
lib/blkid/probe.c

index 4db38b0c56204daf6ffd9c63a8ec4d664bff6a4e..6828c05742c864c2a59db92fddf246142e472c98 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-19  Theodore Ts'o  <tytso@mit.edu>
+
+       * probe.c (blkid_verify_devname): If the time is earlier than the
+               last modified time of the device, then force a reverify;
+               it means the system time may not be trustworthy.
+
 2004-04-12  Theodore Ts'o  <tytso@mit.edu>
 
        * cache.c (blkid_get_cache): If the BLKID_FILE environment
index 7bdab6a65cf8b9d477a148432e5d52dd6b04ce5f..bd8e4570e1882b90d472ed15b98199dd2f4a0189 100644 (file)
@@ -417,16 +417,19 @@ blkid_dev blkid_verify_devname(blkid_cache cache, blkid_dev dev)
        unsigned char *bufs[BLKID_BLK_OFFS + 1], *buf;
        const char *type;
        struct stat st;
-       time_t diff;
+       time_t diff, now;
        int fd, idx;
 
        if (!dev)
                return NULL;
 
-       diff = time(0) - dev->bid_time;
+       now = time(0);
+       diff = now - dev->bid_time;
 
-       if (diff < BLKID_PROBE_MIN || (dev->bid_flags & BLKID_BID_FL_VERIFIED &&
-                                      diff < BLKID_PROBE_INTERVAL))
+       if ((now < dev->bid_time) ||
+           (diff < BLKID_PROBE_MIN) || 
+           (dev->bid_flags & BLKID_BID_FL_VERIFIED &&
+            diff < BLKID_PROBE_INTERVAL))
                return dev;
 
        DBG(DEBUG_PROBE,