mbox-sync.c revision dec504e26667fb97d47f6145e5f65c0bc1c615ea
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "iobuffer.h"
#include "mbox-index.h"
#include "mail-index-util.h"
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
{
unsigned int size;
return 0;
}
/* get the last record */
}
}
offset = 0;
/* get the offset + size of last message, which tells the
last known mbox file size */
"Missing location field for record %u",
"Invalid location field for record %u",
} else {
}
}
/* too large to fit in off_t */
return 0;
}
return offset;
}
{
if (fd == -1) {
return FALSE;
}
if (pos == -1) {
return FALSE;
}
/* someone just shrinked the file? */
return mbox_index_fsck(index);
}
/* add the new data */
MAIL_MMAP_BLOCK_SIZE, 0);
/* it wasn't just new mail, reread the mbox */
return mbox_index_fsck(index);
}
return ret;
}
{
return FALSE;
}
/* |3 is simple workaround for \n at end of file, see below */
return TRUE;
/* problem .. index->mbox_size points to data after the last message.
that should be \n, \r\n, or end of file. modify filesize
accordingly to allow any of the extra 0-2 bytes. Don't actually
bother to open the file and verify it, it'd just slow things.. */
/* just opened the mailbox, and the file size is same as
we expected. don't bother checking it any further. */
return TRUE;
}
/* file has been modified. */
/* file was grown, hopefully just new mail */
return mbox_check_new_mail(index);
} else {
/* something changed, scan through the whole mbox */
return mbox_index_fsck(index);
}
}