From 625f4c5432005830b7f8ae203a8ed7bdcbf67bb0 Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 1 Sep 2001 11:21:28 +0000 Subject: If lseek to wrong value sucessfully happens despite all pre-checks, set __SERR to indicate that stream becomes inconsistent. --- lib/libc/stdio/fseek.c | 1 + lib/libc/stdio/stdio.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c index a3c80c1..d06e408 100644 --- a/lib/libc/stdio/fseek.c +++ b/lib/libc/stdio/fseek.c @@ -297,6 +297,7 @@ dumb: (*seekfn)(fp->_cookie, (fpos_t)offset, whence) == POS_ERR) return (-1); if (ltest && fp->_offset > LONG_MAX) { + fp->_flags |= __SERR; errno = EOVERFLOW; return (-1); } diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index 46dd2df..ea8a4c1 100644 --- a/lib/libc/stdio/stdio.c +++ b/lib/libc/stdio/stdio.c @@ -118,8 +118,10 @@ __sseek(cookie, offset, whence) * (fseek) in the cases it can't detect. */ if (ret < 0) { - if (errret == 0) + if (errret == 0) { + fp->_flags |= __SERR; errno = EINVAL; + } fp->_flags &= ~__SOFF; ret = -1; } else { -- cgit v1.1