# HG changeset patch # User Timo Sirainen # Date 1032770521 -10800 # Node ID 57a111fd821bd4308e69354ed73bc1e4714c1576 # Parent 3dcc2275b4caa06bab682c1a7dff9404ed7768c0 mail_index_compress_data() didn't set used_file_size in header diff -r 3dcc2275b4ca -r 57a111fd821b src/lib-index/mail-index-compress.c --- a/src/lib-index/mail-index-compress.c Mon Sep 23 11:27:32 2002 +0300 +++ b/src/lib-index/mail-index-compress.c Mon Sep 23 11:42:01 2002 +0300 @@ -120,8 +120,7 @@ if (errno == ENOSPC) index->nodiskspace = TRUE; - index_set_error(index, "Error writing to temp index data " - "%s: %m", path); + index_file_set_syscall_error(index, path, "write_full()"); return FALSE; } @@ -145,8 +144,8 @@ if (errno == ENOSPC) index->nodiskspace = TRUE; - index_set_error(index, "Error writing to temp index " - "data %s: %m", path); + index_file_set_syscall_error(index, path, + "write_full()"); return FALSE; } @@ -156,6 +155,17 @@ rec = index->next(index, rec); } + /* update header */ + data_hdr.used_file_size = offset; + + if (lseek(fd, 0, SEEK_SET) < 0) + return index_file_set_syscall_error(index, path, "lseek()"); + + if (write_full(fd, &data_hdr, sizeof(data_hdr)) < 0) { + index_file_set_syscall_error(index, path, "write_full()"); + return FALSE; + } + return TRUE; }