avoid infinite loops on bad file sent to sfgets
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 21 Dec 1993 02:52:27 +0000 (18:52 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 21 Dec 1993 02:52:27 +0000 (18:52 -0800)
SCCS-vsn: usr.sbin/sendmail/src/util.c 8.25

usr/src/usr.sbin/sendmail/src/util.c

index e93249d..4853917 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     8.24 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     8.25 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -891,6 +891,8 @@ sfgets(buf, siz, fp, timeout, during)
                p = fgets(buf, siz, fp);
                if (errno == EINTR)
                        clearerr(fp);
                p = fgets(buf, siz, fp);
                if (errno == EINTR)
                        clearerr(fp);
+               else if (errno == EBADF)
+                       break;
        }
 
        /* clear the event if it has not sprung */
        }
 
        /* clear the event if it has not sprung */