changeset 87:18f0d0952a7d HEAD

fix
author Timo Sirainen <tss@iki.fi>
date Thu, 29 Aug 2002 00:46:30 +0300
parents 73e79cf8f496
children 20e979ad0b6d
files src/lib-index/mbox/mbox-index.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mbox/mbox-index.c	Thu Aug 29 00:42:24 2002 +0300
+++ b/src/lib-index/mbox/mbox-index.c	Thu Aug 29 00:46:30 2002 +0300
@@ -113,10 +113,11 @@
 int mbox_skip_crlf(IOBuffer *inbuf)
 {
 	unsigned char *data;
-	unsigned int size;
+	unsigned int size, pos;
 
-	while (io_buffer_read_data(inbuf, &data, &size, 1) >= 0) {
-		if (size > 0) {
+	pos = 0;
+	while (io_buffer_read_data(inbuf, &data, &size, pos) >= 0) {
+		if (size > 0 && pos == 0) {
 			if (data[0] == '\n') {
 				io_buffer_skip(inbuf, 1);
 				return TRUE;
@@ -124,13 +125,14 @@
 			if (data[0] != '\r')
 				return FALSE;
 
-			if (size > 1) {
-				if (data[1] != '\n')
-					return FALSE;
+			pos++;
+		}
+		if (size > 1 && pos == 1) {
+			if (data[1] != '\n')
+				return FALSE;
 
-				io_buffer_skip(inbuf, 2);
-				return TRUE;
-			}
+			io_buffer_skip(inbuf, 2);
+			return TRUE;
 		}
 	}