openssl.txt: stamp RPATH into library too
[exim.git] / src / src / receive.c
index 5125a4f47525fbb6af01d8b0add9cd255daea2df..7980c324fc1d42c1bca0462928e4cecb89782d00 100644 (file)
@@ -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;