avoid bug in ungetc
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 22 Oct 1980 04:57:24 +0000 (20:57 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 22 Oct 1980 04:57:24 +0000 (20:57 -0800)
SCCS-vsn: usr.sbin/sendmail/src/collect.c 1.5

usr/src/usr.sbin/sendmail/src/collect.c

index 18c633e..bc9ada7 100644 (file)
@@ -3,7 +3,7 @@
 # include <errno.h>
 # include "dlvrmail.h"
 
 # include <errno.h>
 # include "dlvrmail.h"
 
-static char    SccsId[] = "@(#)collect.c       1.4     %G%";
+static char    SccsId[] = "@(#)collect.c       1.5     %G%";
 
 /*
 **  MAKETEMP -- read & parse message header & make temp file.
 
 /*
 **  MAKETEMP -- read & parse message header & make temp file.
@@ -96,7 +96,8 @@ maketemp()
                                if (fgets(p, sizeof buf - (p - buf), stdin) == NULL)
                                        break;
                        }
                                if (fgets(p, sizeof buf - (p - buf), stdin) == NULL)
                                        break;
                        }
-                       ungetc(c, stdin);
+                       if (c != EOF)
+                               ungetc(c, stdin);
                }
 
                if (!IgnrDot && buf[0] == '.' && (buf[1] == '\n' || buf[1] == '\0'))
                }
 
                if (!IgnrDot && buf[0] == '.' && (buf[1] == '\n' || buf[1] == '\0'))