From: Michael Vrable Date: Thu, 12 Jul 2007 20:05:14 +0000 (-0700) Subject: When comparing a file against the stat cache, check size field too. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=94357fda0976dd353bcea97764a08db245113c8f;p=cumulus.git When comparing a file against the stat cache, check size field too. --- diff --git a/statcache.cc b/statcache.cc index 376c099..8e48c79 100644 --- a/statcache.cc +++ b/statcache.cc @@ -121,6 +121,7 @@ void StatCache::ReadNext() old_mtime = -1; old_ctime = -1; old_inode = -1; + old_size = -1; old_checksum = ""; old_contents.clear(); @@ -171,6 +172,8 @@ void StatCache::ReadNext() old_ctime = parse_int(fields["ctime"]); if (fields.count("inode")) old_inode = parse_int(fields["inode"]); + if (fields.count("size")) + old_inode = parse_int(fields["size"]); old_checksum = fields["checksum"]; @@ -225,6 +228,8 @@ bool StatCache::Find(const string &path, const struct stat *stat_buf) return false; if ((long long)stat_buf->st_ino != old_inode) return false; + if (stat_buf->st_size != old_size) + return false; /* File looks to be unchanged. */ return true; diff --git a/statcache.h b/statcache.h index e0e2fbb..6186f88 100644 --- a/statcache.h +++ b/statcache.h @@ -56,7 +56,7 @@ private: /* Information about one file read from the old cache. */ bool end_of_cache; bool old_is_validated; - int64_t old_mtime, old_ctime, old_inode; + int64_t old_mtime, old_ctime, old_inode, old_size; std::string old_name, old_checksum; std::list old_contents; };