Getting size of cache file should not change its position

This commit is contained in:
Kovid Goyal 2024-07-11 06:22:54 +05:30
parent 6958803fec
commit 7d685fc98b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -122,7 +122,10 @@ open_cache_file(const char *cache_path) {
static off_t
size_of_cache_file(DiskCache *self) {
return lseek(self->cache_file_fd, 0, SEEK_END);
off_t pos = lseek(self->cache_file_fd, 0, SEEK_CUR);
off_t ans = lseek(self->cache_file_fd, 0, SEEK_END);
lseek(self->cache_file_fd, pos, SEEK_SET);
return ans;
}
size_t