+2006-03-12 Theodore Ts'o <tytso@mit.edu>
+
+ * probe.c (blkid_verify): Fix the bid_time sanity checking logic,
+ so that if last verification time is more recent than the
+ current time, or the comparison between the last
+ verification time and the current time causes an overflow,
+ a device verification will take place.
+
+ * devname.c (blkid_get_dev): Set the initial bid_time to be
+ INT_MIN, to guarantee that blkid_verify will always be run
+ even when the system clock is insane.
+
+ * dev.c (blkid_debug_dump_dev), read.c (debug_dump_dev),
+ save.c (save_dev): Fix the printf format for dev->bid_time
+ to match the fact that it is an signed type.
+
2006-03-10 Theodore Ts'o <tytso@mit.edu>
* probe.c (probe_ext3): If the filesystem has an external journal,
printf(" dev: name = %s\n", dev->bid_name);
printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
- printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
+ printf(" dev: TIME=\"%ld\"\n", dev->bid_time);
printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
printf(" dev: flags = 0x%08X\n", dev->bid_flags);
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
dev = blkid_new_dev();
if (!dev)
return NULL;
+ dev->bid_time = INT_MIN;
dev->bid_name = blkid_strdup(devname);
dev->bid_cache = cache;
list_add_tail(&dev->bid_devs, &cache->bic_devs);
now = time(0);
diff = now - dev->bid_time;
- if ((now < dev->bid_time) ||
- (diff < BLKID_PROBE_MIN) ||
- (dev->bid_flags & BLKID_BID_FL_VERIFIED &&
- diff < BLKID_PROBE_INTERVAL))
+ if ((now > dev->bid_time) && (diff > 0) &&
+ ((diff < BLKID_PROBE_MIN) ||
+ (dev->bid_flags & BLKID_BID_FL_VERIFIED &&
+ diff < BLKID_PROBE_INTERVAL)))
return dev;
DBG(DEBUG_PROBE,
printf(" dev: name = %s\n", dev->bid_name);
printf(" dev: DEVNO=\"0x%0llx\"\n", dev->bid_devno);
- printf(" dev: TIME=\"%lu\"\n", dev->bid_time);
+ printf(" dev: TIME=\"%ld\"\n", dev->bid_time);
printf(" dev: PRI=\"%d\"\n", dev->bid_pri);
printf(" dev: flags = 0x%08X\n", dev->bid_flags);
printf("device %s, type %s\n", dev->bid_name, dev->bid_type));
fprintf(file,
- "<device DEVNO=\"0x%04lx\" TIME=\"%lu\"",
+ "<device DEVNO=\"0x%04lx\" TIME=\"%ld\"",
(unsigned long) dev->bid_devno, dev->bid_time);
if (dev->bid_pri)
fprintf(file, " PRI=\"%d\"", dev->bid_pri);