summaryrefslogtreecommitdiffstats
path: root/gl/freading.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/freading.c')
-rw-r--r--gl/freading.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gl/freading.c b/gl/freading.c
index c80d9aa8..8e06282e 100644
--- a/gl/freading.c
+++ b/gl/freading.c
@@ -1,5 +1,5 @@
1/* Retrieve information about a FILE stream. 1/* Retrieve information about a FILE stream.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 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
@@ -22,9 +22,13 @@
22#include "stdio-impl.h" 22#include "stdio-impl.h"
23 23
24/* Don't use glibc's __freading function in glibc < 2.7, see 24/* Don't use glibc's __freading function in glibc < 2.7, see
25 <https://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ 25 <https://sourceware.org/PR4359> */
26#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) 26#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
27 27
28/* This code is not compiled on systems that have a working __freading function,
29 namely glibc >= 2.7, OpenBSD >= 7.6, Solaris >= 7, UnixWare >= 7.1.4.MP4,
30 Cygwin >= 1.7.34, Android API >= 28, musl libc, Haiku >= hrev58760. */
31
28bool 32bool
29freading (FILE *fp) 33freading (FILE *fp)
30{ 34{
@@ -37,13 +41,13 @@ freading (FILE *fp)
37 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 41 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
38 && fp->_IO_read_base != NULL)); 42 && fp->_IO_read_base != NULL));
39# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 43# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
40 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ 44 /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */
41 return (fp_->_flags & __SRD) != 0; 45 return (fp_->_flags & __SRD) != 0;
42# elif defined __EMX__ /* emx+gcc */ 46# elif defined __EMX__ /* emx+gcc */
43 return (fp->_flags & _IOREAD) != 0; 47 return (fp->_flags & _IOREAD) != 0;
44# elif defined __minix /* Minix */ 48# elif defined __minix /* Minix */
45 return (fp->_flags & _IOREADING) != 0; 49 return (fp->_flags & _IOREADING) != 0;
46# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ 50# elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
47# if defined __sun /* Solaris */ 51# if defined __sun /* Solaris */
48 return (fp_->_flag & _IOREAD) != 0 && (fp_->_flag & _IOWRT) == 0; 52 return (fp_->_flag & _IOREAD) != 0 && (fp_->_flag & _IOWRT) == 0;
49# else 53# else