X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Freceive.c;h=7980c324fc1d42c1bca0462928e4cecb89782d00;hb=e236f915d39e27c89ac6e9ef8dd6bdf38f164a6b;hp=5125a4f47525fbb6af01d8b0add9cd255daea2df;hpb=d953610fa77ec9a08fad9c1a183181079a79674e;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/receive.c b/src/src/receive.c index 5125a4f47..7980c324f 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -906,7 +906,8 @@ a cut-down version of the state-machine above; we don't need to do leading-dot detection and unstuffing. Arguments: - fout a FILE to which to write the message; NULL if skipping + fout a FILE to which to write the message; NULL if skipping; + must be open for both writing and reading. Returns: One of the END_xxx values indicating why it stopped reading */ @@ -937,8 +938,11 @@ for(;;) that would need to be duplicated here. So we simply do some ungetc trickery. */ - fseek(fout, -1, SEEK_CUR); - if (fgetc(fout) == '\n') return END_DOT; + if (fout) + { + if (fseek(fout, -1, SEEK_CUR) < 0) return END_PROTOCOL; + if (fgetc(fout) == '\n') return END_DOT; + } if (linelength == -1) /* \r already seen (see below) */ { @@ -986,7 +990,7 @@ for(;;) else { message_size++; - if (fout != NULL && fputc('\n', fout) == EOF) return END_WERROR; + if (fout && fputc('\n', fout) == EOF) return END_WERROR; (void) cutthrough_put_nl(); if (ch == '\r') continue; /* don't write CR */ ch_state = MID_LINE;