summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2014-04-02 14:43:34 +0500
committerSunil Nimmagadda <sunil@nimmagadda.net>2014-04-02 14:43:34 +0500
commit82879323268fdd0d2eb08b5fd4f84407543466d9 (patch)
tree6f521090ae2fc3a9b977121f1c50021679713fc6
parented034f8989e711a99be36d0f148d8e65ad5d0c88 (diff)
Return correct nlines for RETR in maildir handling.
-rw-r--r--maildir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/maildir.c b/maildir.c
index f3d7178..1b11410 100644
--- a/maildir.c
+++ b/maildir.c
@@ -101,7 +101,7 @@ init(struct mdrop *m, size_t *nmsgs, size_t *sz)
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 @@ retr(struct mdrop *m, unsigned int idx, size_t *nlines, size_t *offset)
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");