diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2022-01-05 20:57:28 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2022-01-05 20:57:28 +0000 |
commit | 2c9573a223f521a52162be2e51576af44989bb9d (patch) | |
tree | 5caa3c9155f1745d7f23c0b6fa42818c35a83ae6 /lib/libc | |
parent | d472943526459bd7240a346587700eaf264603c2 (diff) |
funopen(): change seekfn argument to use off_t, not fpos_t
On BSD, fpos_t is typedef'd to off_t but some systems use a struct.
This means fpos_t is not a portable function argument or return value.
Both FreeBSD and the Linux libbsd funopen() have switched to off_t
for this--we should too. From Joe Nelson. OK deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/funopen.3 | 13 | ||||
-rw-r--r-- | lib/libc/stdio/funopen.c | 4 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/libc/stdio/funopen.3 b/lib/libc/stdio/funopen.3 index 5138bf1160b..0348e49304d 100644 --- a/lib/libc/stdio/funopen.3 +++ b/lib/libc/stdio/funopen.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: funopen.3,v 1.18 2015/11/04 21:30:13 tedu Exp $ +.\" $OpenBSD: funopen.3,v 1.19 2022/01/05 20:57:27 millert Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: November 4 2015 $ +.Dd $Mdocdate: January 5 2022 $ .Dt FUNOPEN 3 .Os .Sh NAME @@ -42,7 +42,7 @@ .Ft FILE * .Fn funopen "const void *cookie" "int (*readfn)(void *, char *, int)" \ "int (*writefn)(void *, const char *, int)" \ - "fpos_t (*seekfn)(void *, fpos_t, int)" \ + "off_t (*seekfn)(void *, off_t, int)" \ "int (*closefn)(void *)" .Ft FILE * .Fn fropen "const void *cookie" "int (*readfn)(void *, char *, int)" @@ -84,12 +84,7 @@ with the exceptions that they are passed the .Fa cookie argument specified to .Fn funopen -in place of the traditional file descriptor argument and that -the seek function takes an -.Li fpos_t -argument and not an -.Li off_t -argument. +in place of the traditional file descriptor argument. .Pp Read and write I/O functions are allowed to change the underlying buffer on fully buffered or line buffered streams by calling diff --git a/lib/libc/stdio/funopen.c b/lib/libc/stdio/funopen.c index b6fc464b4aa..8c0aafbf204 100644 --- a/lib/libc/stdio/funopen.c +++ b/lib/libc/stdio/funopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: funopen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: funopen.c,v 1.10 2022/01/05 20:57:27 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -38,7 +38,7 @@ FILE * funopen(const void *cookie, int (*readfn)(void *, char *, int), int (*writefn)(void *, const char *, int), - fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *)) + off_t (*seekfn)(void *, off_t, int), int (*closefn)(void *)) { FILE *fp; int flags; |