changeset 199:cf1279829ad1 HEAD

custom flag & copy crash fixes.
author Timo Sirainen <tss@iki.fi>
date Mon, 09 Sep 2002 14:55:27 +0300
parents e6e5fd3d4718
children 16ae7b6a2f0b
files src/lib-index/mail-custom-flags.c src/lib-index/mail-modifylog.c src/lib-storage/index/index-save.c src/lib/iobuffer.h
diffstat 4 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-custom-flags.c	Mon Sep 09 10:18:50 2002 +0300
+++ b/src/lib-index/mail-custom-flags.c	Mon Sep 09 14:55:27 2002 +0300
@@ -513,9 +513,8 @@
 
 	flag = MAIL_CUSTOM_FLAG_1;
 	for (i = 0; i < count; i++, flag <<= 1) {
-		if (oldflags & flag) {
-			i_assert(custom_flags[i] != NULL &&
-				 *custom_flags[i] != '\0');
+		if ((oldflags & flag) && custom_flags[i] != NULL) {
+			i_assert(*custom_flags[i] != '\0');
 
 			idx = get_flag_index(mcf, custom_flags[i], i);
 			if (idx == -1) {
--- a/src/lib-index/mail-modifylog.c	Mon Sep 09 10:18:50 2002 +0300
+++ b/src/lib-index/mail-modifylog.c	Mon Sep 09 14:55:27 2002 +0300
@@ -124,7 +124,7 @@
 	if (log->mmap_length < sizeof(ModifyLogHeader)) {
 		/* FIXME: we could do better.. */
 		(void)unlink(log->filepath);
-		i_assert(0);
+		i_panic("modify log corrupted");
 	}
 
 	extra = (log->mmap_length - sizeof(ModifyLogHeader)) %
--- a/src/lib-storage/index/index-save.c	Mon Sep 09 10:18:50 2002 +0300
+++ b/src/lib-storage/index/index-save.c	Mon Sep 09 14:55:27 2002 +0300
@@ -48,7 +48,7 @@
 	last_cr = FALSE;
 
 	while (data_size > 0) {
-		ret = io_buffer_read_blocking(buf, (size_t)-1);
+		ret = io_buffer_read_blocking(buf, SSIZE_T_MAX);
 		if (ret < 0) {
 			mail_storage_set_critical(storage,
 						  "Error reading mail: %m");
--- a/src/lib/iobuffer.h	Mon Sep 09 10:18:50 2002 +0300
+++ b/src/lib/iobuffer.h	Mon Sep 09 14:55:27 2002 +0300
@@ -114,7 +114,7 @@
 /* Blocking read, doesn't return until at least one byte is read, or until
    socket is disconnected or timeout has occured. Note that the fd must be
    nonblocking, or the timeout doesn't work. If you don't want limit size,
-   set it to (size_t)-1. Returns number of bytes read, or -1 if error. */
+   set it to SSIZE_T_MAX. Returns number of bytes read, or -1 if error. */
 ssize_t io_buffer_read_blocking(IOBuffer *buf, size_t size);
 /* Skip forward a number of bytes */
 void io_buffer_skip(IOBuffer *buf, uoff_t size);