From 2dd4055cf26d85600a22205ae6e9ed668d614f26 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 31 Jul 2001 05:54:41 +0000 Subject: Must solve that damn linking problem next. svn path=/trunk/; revision=3426 --- imap.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'imap.c') diff --git a/imap.c b/imap.c index cfc85fa6..7ea1ef98 100644 --- a/imap.c +++ b/imap.c @@ -672,13 +672,19 @@ static int imap_fetch_headers(int sock, struct query *ctl,int number,int *lenp) gen_send(sock, "FETCH %d RFC822.HEADER", number); /* looking for FETCH response */ - do { + for (;;) + { int ok; if ((ok = gen_recv(sock, buf, sizeof(buf)))) return(ok); - } while - (sscanf(buf+2, "%d FETCH (%*s {%d}", &num, lenp) != 2); + if (sscanf(buf+2, "%d FETCH (%*s {%d}", &num, lenp) == 2) + break; + else if (sscanf(buf+2, "%d NO", &num) == 1) + return(PS_ERROR); + else if (sscanf(buf+2, "%d BAD", &num) == 1) + return(PS_ERROR); + } if (num != number) return(PS_ERROR); -- cgit v1.2.3