aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-block-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-block-file.c')
-rw-r--r--camel/camel-block-file.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/camel/camel-block-file.c b/camel/camel-block-file.c
index 0340f9ecdf..e73b266026 100644
--- a/camel/camel-block-file.c
+++ b/camel/camel-block-file.c
@@ -98,11 +98,22 @@ block_file_validate_root(CamelBlockFile *bs)
fstat(bs->fd, &st);
- d(printf("Validate root:\n"));
- d(printf("version: %.8s (%.8s)\n", bs->root->version, bs->version));
- d(printf("block size: %d (%d)\n", br->block_size, bs->block_size));
- d(printf("free: %d (%d add size < %d)\n", br->free, br->free / bs->block_size * bs->block_size, (int)st.st_size));
- d(printf("last: %d (%d and size: %d)\n", br->free, br->free / bs->block_size * bs->block_size, (int)st.st_size));
+ (printf("Validate root:\n"));
+ (printf("version: %.8s (%.8s)\n", bs->root->version, bs->version));
+ (printf("block size: %d (%d)%s\n", br->block_size, bs->block_size,
+ br->block_size != bs->block_size ? " BAD":" OK"));
+ (printf("free: %ld (%d add size < %ld)%s\n", (long)br->free, br->free / bs->block_size * bs->block_size, (long)st.st_size,
+ (br->free > st.st_size) || (br->free % bs->block_size) != 0 ? " BAD":" OK"));
+ (printf("last: %ld (%d and size: %ld)%s\n", (long)br->last, br->last / bs->block_size * bs->block_size, (long)st.st_size,
+ (br->last != st.st_size) || ((br->last % bs->block_size) != 0) ? " BAD": " OK"));
+ (printf("flags: %s\n", (br->flags & CAMEL_BLOCK_FILE_SYNC)?"SYNC":"unSYNC"));
+
+ printf("last = %ld, size = %ld\n", (unsigned long)br->last, (unsigned long)st.st_size);
+
+ if (br->last != st.st_size)
+ printf("last != size!\n");
+ else
+ printf("last == size?\n");
if (br->last == 0
|| memcmp(bs->root->version, bs->version, 8) != 0
@@ -476,6 +487,7 @@ int camel_block_file_free_block(CamelBlockFile *bs, camel_block_t id)
((camel_block_t *)bl->data)[0] = bs->root->free;
bs->root->free = bl->id;
+ bs->root_block->flags |= CAMEL_BLOCK_DIRTY;
bl->flags |= CAMEL_BLOCK_DIRTY;
camel_block_file_unref_block(bs, bl);