summaryrefslogtreecommitdiff
path: root/lib/blkid/devname.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2006-03-12 23:25:15 -0500
committerTheodore Ts'o <tytso@mit.edu>2006-03-12 23:25:15 -0500
commite324b250593a32680309015eba7c6c5db7851227 (patch)
treee81329682fb802cb3f655b66feff6fbf26e05b6b /lib/blkid/devname.c
parent3f546fcc27e9bfca8d365c4d78c6e6c99ca32512 (diff)
downloade2fsprogs-e324b250593a32680309015eba7c6c5db7851227.tar.gz
Fix blkid's last verification logic to work when the system clock is insane
Users have reported problems on newly installed systems when the Macintosh's system clock battery is dead and the hardware clock is returning a date of 1904. Turns out there were some bugs in handling dates before the Unix epoch. Addresses Red Hat Bug: #182188 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. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/blkid/devname.c')
-rw-r--r--lib/blkid/devname.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index 0a13c477..b2ff40f0 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -70,6 +71,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags)
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);