Return correct nlines for RETR in maildir handling.
authorSunil Nimmagadda <sunil@nimmagadda.net>
Wed, 02 Apr 2014 14:44:04 +0500
changeset 9 52527e90ed80
parent 8 dd898f214ed7
child 10 d1fb040b60d9
Return correct nlines for RETR in maildir handling.
maildir.c
--- a/maildir.c	Wed Apr 02 13:14:04 2014 +0500
+++ b/maildir.c	Wed Apr 02 14:44:04 2014 +0500
@@ -101,7 +101,7 @@
 		SHA1Init(&ctx);
 		while (( len = read(msg_fd, buf, sizeof(buf))) > 0) {
 			SHA1Update(&ctx, (u_int8_t *)buf, len);
-			for (C = buf;len--; ++C)
+			for (C = buf; len--; ++C)
 				if (*C == '\n')
 					msg->nlines += 1;
 		}
@@ -176,6 +176,7 @@
 	int	fd, r;
 
 	*offset = 0;
+	*nlines = m->msgs_index[idx]->nlines;
 	r = snprintf(buf, sizeof(buf), "cur/%s", m->msgs_index[idx]->u.fname);
 	if ((u_int)r >= sizeof(buf)) {
 		logit(LOG_WARNING, "path too long");