mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
split: reset errno prior to getline()
Something else may have set errno, breaking the post-getline() logic
that tries to detect the getline() error. This was initially noted in
a jail on a system that has HPET, in a jail that does not expose
/dev/hpet0 -- we see an earlier error in libc's vdso bits.
Fixes: 5c053aa3c5
("split: switch to getline() [...]")
This commit is contained in:
parent
ff270fce16
commit
172be8642d
|
@ -278,7 +278,7 @@ split2(void)
|
||||||
err(EX_NOINPUT, "fdopen");
|
err(EX_NOINPUT, "fdopen");
|
||||||
|
|
||||||
/* Process input one line at a time */
|
/* Process input one line at a time */
|
||||||
while ((len = getline(&buf, &bufsize, infp)) > 0) {
|
while ((errno = 0, len = getline(&buf, &bufsize, infp)) > 0) {
|
||||||
/* Check if we need to start a new file */
|
/* Check if we need to start a new file */
|
||||||
if (pflag) {
|
if (pflag) {
|
||||||
regmatch_t pmatch;
|
regmatch_t pmatch;
|
||||||
|
|
Loading…
Reference in a new issue