From b0afb8fe0ff1d87165af9df61501197a06240dda Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 28 Dec 2025 12:13:40 +0100 Subject: Sync with Gnulib stable-202507 code (a8ac9f9ce5) --- gl/fseeko.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'gl/fseeko.c') 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 @@ /* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -48,12 +48,15 @@ fseeko (FILE *fp, off_t offset, int whence) /* These tests are based on fpurge.c. */ #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 +# if !defined __HAIKU__ +# define fp_ fp +# endif /* GNU libc, BeOS, Haiku, Linux libc5 */ - if (fp->_IO_read_end == fp->_IO_read_ptr - && fp->_IO_write_ptr == fp->_IO_write_base - && fp->_IO_save_base == NULL) + if (fp_->_IO_read_end == fp_->_IO_read_ptr + && fp_->_IO_write_ptr == fp_->_IO_write_base + && fp_->_IO_save_base == NULL) #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __SL64 && defined __SCLE /* Cygwin */ if ((fp->_flags & __SL64) == 0) { @@ -101,6 +104,9 @@ fseeko (FILE *fp, off_t offset, int whence) #elif defined EPLAN9 /* Plan9 */ if (fp->rp == fp->buf && fp->wp == fp->buf) +#elif defined __OpenBSD__ && !defined __sferror /* OpenBSD >= 7.8 */ + /* fseeko and fflush work as advertised. */ + if (0) #elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION /* Cross-compiling to some other system advertising conformance to POSIX.1-2008 or later. Assume fseeko and fflush work as advertised. @@ -118,7 +124,7 @@ fseeko (FILE *fp, off_t offset, int whence) if (pos == -1) { #if defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ fp_->_flags &= ~__SOFF; #endif return -1; @@ -126,10 +132,10 @@ fseeko (FILE *fp, off_t offset, int whence) #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ - fp->_flags &= ~_IO_EOF_SEEN; - fp->_offset = pos; + fp_->_flags &= ~_IO_EOF_SEEN; + fp_->_offset = pos; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix /* fp_->_offset is typed as an integer. */ fp_->_offset = pos; -- cgit v1.2.3-74-g34f1