aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMath Ieu <sigsys@gmail.com>2022-10-27 17:01:57 +0000
committerKyle Evans <kevans@FreeBSD.org>2022-10-27 17:17:59 +0000
commit172be8642d93851b0c083d0db240cf35fd56ab0e (patch)
tree3485a87f43ea6578ede2a9f3527c61b6a3edbbd8 /usr.bin
parentff270fce1631cdfbf8d3d76b9a9f5342b78972c9 (diff)
downloadsrc-172be8642d93851b0c083d0db240cf35fd56ab0e.tar.gz
src-172be8642d93851b0c083d0db240cf35fd56ab0e.zip
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: 5c053aa3c5e90 ("split: switch to getline() [...]")
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/split/split.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c
index 008b614f4946..091c914ba8f7 100644
--- a/usr.bin/split/split.c
+++ b/usr.bin/split/split.c
@@ -278,7 +278,7 @@ split2(void)
err(EX_NOINPUT, "fdopen");
/* 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 */
if (pflag) {
regmatch_t pmatch;