blkid: fix blkid time diff bug

When calculating time diffs, use difftime() instead of risking
integer overflow.  Also build a "blkid" binary.

Addresses-Google-Bug: #11175082
Change-Id: I23521f45204574bb32f152926401c2cbad93175b

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debian
Jeff Sharkey 2013-10-16 15:42:12 -07:00 committed by Theodore Ts'o
parent 5efe492d19
commit 62bc8d19bd
1 changed files with 3 additions and 2 deletions

View File

@ -1532,14 +1532,15 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
unsigned char *buf;
const char *type, *value;
struct stat st;
time_t diff, now;
time_t now;
double diff;
int idx;
if (!dev)
return NULL;
now = time(0);
diff = now - dev->bid_time;
diff = difftime(now, dev->bid_time);
if (stat(dev->bid_name, &st) < 0) {
DBG(DEBUG_PROBE,