mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-14 20:37:06 +00:00
dma: use canonical getline() loop
getline() returns -1 on erorr or EOF, so use that condition instead of
feof() and check that there was no error after the loop exits.
Reviewed by: bapt, kevans (both earlier)
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34159
(cherry picked from commit d21e71efce
)
This commit is contained in:
parent
7b8bb67135
commit
2e8403e021
|
@ -405,10 +405,8 @@ readmail(struct queue *queue, int nodot, int recp_from_header)
|
|||
if ((ssize_t)error < 0)
|
||||
return (-1);
|
||||
|
||||
while (!feof(stdin)) {
|
||||
while ((linelen = getline(&line, &linecap, stdin)) > 0) {
|
||||
newline[0] = '\0';
|
||||
if ((linelen = getline(&line, &linecap, stdin)) <= 0)
|
||||
break;
|
||||
if (had_last_line)
|
||||
errlogx(EX_DATAERR, "bad mail input format:"
|
||||
" from %s (uid %d) (envelope-from %s)",
|
||||
|
@ -510,8 +508,8 @@ readmail(struct queue *queue, int nodot, int recp_from_header)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
if (ferror(stdin) == 0)
|
||||
ret = 0;
|
||||
fail:
|
||||
free(line);
|
||||
return (ret);
|
||||
|
|
Loading…
Reference in a new issue