In next(), ensure that 'done' is set in the case when a file cannot

be opened, to avoid trying to read standard input after already closing
it, which resulted in EBADF errors.
This commit is contained in:
Tim J. Robbins 2004-08-04 02:47:32 +00:00
parent c92781c506
commit 9a1e2d06e8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133099

View File

@ -346,13 +346,14 @@ next(char **argv)
}
for (;;) {
if (*_argv) {
done = 1;
if (!(freopen(*_argv, "r", stdin))) {
warn("%s", *_argv);
exitval = 1;
++_argv;
continue;
}
statok = done = 1;
statok = 1;
} else {
if (done++)
return(0);