diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c index 68cb4b94657..2194ae7ab59 100644 --- a/usr.bin/lam/lam.c +++ b/usr.bin/lam/lam.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #define MAXOFILES 20 @@ -212,6 +213,9 @@ gatherline(struct openfile *ip) *p = '\0'; if (c == EOF) { ip->eof = 1; + if (ferror(ip->fp)) { + err(EX_IOERR, NULL); + } if (ip->fp == stdin) fclose(stdin); morefiles--;