]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
fixed fgets() loop
authormortenp <none@none>
Wed, 2 Jun 2004 21:34:32 +0000 (07:34 +1000)
committermortenp <none@none>
Wed, 2 Jun 2004 21:34:32 +0000 (07:34 +1000)
src/mail-functions.c

index f01505aaf5492b8f761ca59c91b40b21876494b1..cdfc1c538215a1e78b37b3469f370380a2dd4f65 100644 (file)
@@ -121,6 +121,9 @@ int write_mailbody_from_file(int sockfd, FILE *infile)
        /* 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;