> The attached patch fixes this.

Just a cosmetic fix - the defined prot_putc now returns EOF in case of error.
diff -r -u cyrus-imapd-2.1.11.orig/lib/prot.c cyrus-imapd-2.1.11/lib/prot.c
--- cyrus-imapd-2.1.11.orig/lib/prot.c	Mon Oct 21 22:44:22 2002
+++ cyrus-imapd-2.1.11/lib/prot.c	Sat Jan  4 23:19:56 2003
@@ -793,6 +793,7 @@
 int prot_putc(int c, struct protstream *s)
 {
     assert(s->write);
+    if(s->error || s->eof) return EOF;
     assert(s->cnt > 0);
 
     *s->ptr++ = c;
diff -r -u cyrus-imapd-2.1.11.orig/lib/prot.h cyrus-imapd-2.1.11/lib/prot.h
--- cyrus-imapd-2.1.11.orig/lib/prot.h	Tue Apr  2 05:59:04 2002
+++ cyrus-imapd-2.1.11/lib/prot.h	Sat Jan  4 23:21:55 2003
@@ -104,7 +104,7 @@
 
 #define prot_getc(s) ((s)->cnt-- > 0 ? (int)*(s)->ptr++ : prot_fill(s))
 #define prot_ungetc(c, s) ((s)->cnt++, (*--(s)->ptr = (c)))
-#define prot_putc(c, s) ((*(s)->ptr++ = (c)), --(s)->cnt == 0 ? prot_flush(s) : 0)
+#define prot_putc(c, s) (!((s)->error || (s)->eof) ? ((*(s)->ptr++ = (c)), --(s)->cnt == 0 ? prot_flush(s) : 0) : EOF)
 #define prot_BLOCK(s) ((s)->dontblock = 0)
 #define prot_NONBLOCK(s) ((s)->dontblock = 1)
 


Reply via email to