summaryrefslogtreecommitdiffstats
path: root/gl/fseeko.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/fseeko.c')
-rw-r--r--gl/fseeko.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gl/fseeko.c b/gl/fseeko.c
index 2c3b053a..ecd2f83a 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -1,5 +1,5 @@
1/* An fseeko() function that, together with fflush(), is POSIX compliant. 1/* An fseeko() function that, together with fflush(), is POSIX compliant.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2025 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -48,12 +48,15 @@ fseeko (FILE *fp, off_t offset, int whence)
48 48
49 /* These tests are based on fpurge.c. */ 49 /* These tests are based on fpurge.c. */
50#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 50#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
51# if !defined __HAIKU__
52# define fp_ fp
53# endif
51 /* GNU libc, BeOS, Haiku, Linux libc5 */ 54 /* GNU libc, BeOS, Haiku, Linux libc5 */
52 if (fp->_IO_read_end == fp->_IO_read_ptr 55 if (fp_->_IO_read_end == fp_->_IO_read_ptr
53 && fp->_IO_write_ptr == fp->_IO_write_base 56 && fp_->_IO_write_ptr == fp_->_IO_write_base
54 && fp->_IO_save_base == NULL) 57 && fp_->_IO_save_base == NULL)
55#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 58#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
56 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 59 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
57# if defined __SL64 && defined __SCLE /* Cygwin */ 60# if defined __SL64 && defined __SCLE /* Cygwin */
58 if ((fp->_flags & __SL64) == 0) 61 if ((fp->_flags & __SL64) == 0)
59 { 62 {
@@ -101,6 +104,9 @@ fseeko (FILE *fp, off_t offset, int whence)
101#elif defined EPLAN9 /* Plan9 */ 104#elif defined EPLAN9 /* Plan9 */
102 if (fp->rp == fp->buf 105 if (fp->rp == fp->buf
103 && fp->wp == fp->buf) 106 && fp->wp == fp->buf)
107#elif defined __OpenBSD__ && !defined __sferror /* OpenBSD >= 7.8 */
108 /* fseeko and fflush work as advertised. */
109 if (0)
104#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION 110#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
105 /* Cross-compiling to some other system advertising conformance to 111 /* Cross-compiling to some other system advertising conformance to
106 POSIX.1-2008 or later. Assume fseeko and fflush work as advertised. 112 POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
@@ -118,7 +124,7 @@ fseeko (FILE *fp, off_t offset, int whence)
118 if (pos == -1) 124 if (pos == -1)
119 { 125 {
120#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ 126#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
121 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 127 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
122 fp_->_flags &= ~__SOFF; 128 fp_->_flags &= ~__SOFF;
123#endif 129#endif
124 return -1; 130 return -1;
@@ -126,10 +132,10 @@ fseeko (FILE *fp, off_t offset, int whence)
126 132
127#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 133#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
128 /* GNU libc, BeOS, Haiku, Linux libc5 */ 134 /* GNU libc, BeOS, Haiku, Linux libc5 */
129 fp->_flags &= ~_IO_EOF_SEEN; 135 fp_->_flags &= ~_IO_EOF_SEEN;
130 fp->_offset = pos; 136 fp_->_offset = pos;
131#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 137#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
132 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 138 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
133# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix 139# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix
134 /* fp_->_offset is typed as an integer. */ 140 /* fp_->_offset is typed as an integer. */
135 fp_->_offset = pos; 141 fp_->_offset = pos;