struct stat_file_block *block;
struct stat_file_header *header;
+ if (size <
+ sizeof (struct stat_file_header) + sizeof (struct stat_file_section) + sizeof (block)) {
+ msg_err ("file %s is too small to carry any statistic: %z", filename, size);
+ return NULL;
+ }
+
/* First of all rename old file */
memory_pool_lock_mutex (pool->lock);
return 0;
}
+ if (size <
+ sizeof (struct stat_file_header) + sizeof (struct stat_file_section) + sizeof (block)) {
+ msg_err ("file %s is too small to carry any statistic: %z", filename, size);
+ return -1;
+ }
+
memory_pool_lock_mutex (pool->lock);
nblocks = (size - sizeof (struct stat_file_header) - sizeof (struct stat_file_section)) / sizeof (struct stat_file_block);
header.total_blocks = nblocks;