changeset 152:2fb415c3738f

fixed fgets() loop
author mortenp
date Thu, 03 Jun 2004 07:34:32 +1000
parents 1a324eeb3b36
children 1c3083e7acfa
files src/mail-functions.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/mail-functions.c	Thu Jun 03 05:27:20 2004 +1000
+++ b/src/mail-functions.c	Thu Jun 03 07:34:32 2004 +1000
@@ -121,6 +121,9 @@
 	/* keep writing chunks of line (max WRITE_BUFSIZE) */
 	for(;;) {
 		bufp = buf+1;
+		errno = 0;  /* We must reset errno, otherwise we can't
+			     * determine if we hit EOF or an error
+			     * occurred */
 		if(!fgets(bufp, WRITE_BUFSIZE, infile)) {
 			if (errno == EINTR) {
 				continue;