This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.1'.
[unix-history] / usr.sbin / sendmail / src / collect.c
index 1b9ff1e..b434d49 100644 (file)
@@ -33,7 +33,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)collect.c  8.5 (Berkeley) 10/15/93";
+static char sccsid[] = "@(#)collect.c  8.9 (Berkeley) 1/31/94";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -160,7 +160,10 @@ collect(smtpmode, requeueflag, e)
                        if (sfgets(freebuf, MAXLINE, InChannel,
                                        TimeOuts.to_datablock,
                                        "message header read") == NULL)
                        if (sfgets(freebuf, MAXLINE, InChannel,
                                        TimeOuts.to_datablock,
                                        "message header read") == NULL)
-                               goto readerr;
+                       {
+                               freebuf[0] = '\0';
+                               break;
+                       }
 
                        /* is this a continuation line? */
                        if (*freebuf != ' ' && *freebuf != '\t')
 
                        /* is this a continuation line? */
                        if (*freebuf != ' ' && *freebuf != '\t')
@@ -257,7 +260,8 @@ collect(smtpmode, requeueflag, e)
                        break;
 
                /* check for transparent dot */
                        break;
 
                /* check for transparent dot */
-               if (OpMode == MD_SMTP && bp[0] == '.' && bp[1] == '.')
+               if ((OpMode == MD_SMTP || OpMode == MD_DAEMON) &&
+                   bp[0] == '.' && bp[1] == '.')
                        bp++;
 
                /*
                        bp++;
 
                /*
@@ -278,16 +282,21 @@ collect(smtpmode, requeueflag, e)
        if (feof(InChannel) || ferror(InChannel))
        {
 readerr:
        if (feof(InChannel) || ferror(InChannel))
        {
 readerr:
+               if (tTd(30, 1))
+                       printf("collect: read error\n");
                inputerr = TRUE;
        }
 
        if (fflush(tf) != 0)
                tferror(tf, e);
                inputerr = TRUE;
        }
 
        if (fflush(tf) != 0)
                tferror(tf, e);
-       (void) fsync(fileno(tf));
-       (void) fclose(tf);
+       if (fsync(fileno(tf)) < 0 || fclose(tf) < 0)
+       {
+               syserr("cannot sync message data to disk (%s)", e->e_df);
+               finis();
+       }
 
        /* An EOF when running SMTP is an error */
 
        /* An EOF when running SMTP is an error */
-       if (inputerr && OpMode == MD_SMTP)
+       if (inputerr && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
        {
                char *host;
                char *problem;
        {
                char *host;
                char *problem;
@@ -308,8 +317,11 @@ readerr:
                            "collect: %s on connection from %s, sender=%s: %m\n",
                            problem, host, e->e_from.q_paddr);
 # endif
                            "collect: %s on connection from %s, sender=%s: %m\n",
                            problem, host, e->e_from.q_paddr);
 # endif
-               (feof(InChannel) ? usrerr : syserr)
-                       ("451 collect: %s on connection from %s, from=%s",
+               if (feof(InChannel))
+                       usrerr("451 collect: %s on connection from %s, from=%s",
+                               problem, host, e->e_from.q_paddr);
+               else
+                       syserr("451 collect: %s on connection from %s, from=%s",
                                problem, host, e->e_from.q_paddr);
 
                /* don't return an error indication */
                                problem, host, e->e_from.q_paddr);
 
                /* don't return an error indication */