summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fseek.3
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-08-15 02:07:47 +0000
committerache <ache@FreeBSD.org>2001-08-15 02:07:47 +0000
commit9d7273169f482f1f74606c9f559ecc986f668088 (patch)
treec651de630103d0b82ee727fa499a87af0697e6f6 /lib/libc/stdio/fseek.3
parent679dd2c9f81d6f490f3db2613cb62f20c7cf93ab (diff)
downloadFreeBSD-src-9d7273169f482f1f74606c9f559ecc986f668088.zip
FreeBSD-src-9d7273169f482f1f74606c9f559ecc986f668088.tar.gz
1) Disallow negative seek as POSIX require for fseek{o} (but not for lseek):
"[EINVAL] ... The resulting file-position indicator would be set to a negative value." Moreover, in real life negative seek in stdio cause EOF indicator cleared and not set again forever even if EOF returned. 2) Catch few possible off_t overflows. Reviewed by: arch discussion
Diffstat (limited to 'lib/libc/stdio/fseek.3')
-rw-r--r--lib/libc/stdio/fseek.316
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/libc/stdio/fseek.3 b/lib/libc/stdio/fseek.3
index 9a58668..b37aa17 100644
--- a/lib/libc/stdio/fseek.3
+++ b/lib/libc/stdio/fseek.3
@@ -180,18 +180,12 @@ is not a seekable stream.
.It Bq Er EINVAL
The
.Fa whence
-argument to
-.Fn fseek
-was not
-.Dv SEEK_SET ,
-.Dv SEEK_END ,
-or
-.Dv SEEK_CUR .
+argument is invalid.
+The resulting file-position
+indicator would be set to a negative value.
.It Bq Er EOVERFLOW
-For
-.Fn ftell ,
-the resulting file offset would be a value which
-cannot be represented correctly in an object of type long.
+The resulting file offset would be a value which
+cannot be represented correctly in an object of type requested.
.El
.Pp
The functions
OpenPOWER on IntegriCloud