From: Theodore Ts'o Date: Tue, 20 Apr 2004 01:42:18 +0000 (-0400) Subject: probe.c (blkid_verify_devname): If the time is earlier than the X-Git-Tag: E2FSPROGS-1_36~176 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ce08064061ed66647fa2c152c65f2f28eac9a0a;p=thirdparty%2Fe2fsprogs.git 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. --- diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index 4db38b0c5..6828c0574 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,3 +1,9 @@ +2004-04-19 Theodore Ts'o + + * 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 * cache.c (blkid_get_cache): If the BLKID_FILE environment diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index 7bdab6a65..bd8e4570e 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -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,