Mercurial > dovecot > original-hg > dovecot-1.2
changeset 291:57a111fd821b HEAD
mail_index_compress_data() didn't set used_file_size in header
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 23 Sep 2002 11:42:01 +0300 |
parents | 3dcc2275b4ca |
children | 7a4fac415698 |
files | src/lib-index/mail-index-compress.c |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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; }