mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
lam: fail on I/O errors
I/O errors should be reported; however lam currently does not disambiguate between EOF because end-of-file was reached and EOF because an I/O error occurred. This commit changes lam to exit with EX_IOERR when an I/O error occurs. Reviewed by: imp, allanjude Sponsored by: Apple Inc. Differential Revision: https://reviews.freebsd.org/D45437
This commit is contained in:
parent
60107d23d8
commit
4472fd66d0
1 changed files with 4 additions and 0 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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--;
|
||||
|
|
|
|||
Loading…
Reference in a new issue