X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Ffseterr.c;h=81f51edade3efb01647d9ea5c120e114d1c2aa93;hb=92249085071a973e2c0621b0415b93d2e48bb00d;hp=b1a379ebba8de04a1adfac20f946d12deefbb655;hpb=dc0ab95dbae38577efebe2283fc9b76e92ef4233;p=debian%2Fgzip diff --git a/lib/fseterr.c b/lib/fseterr.c index b1a379e..81f51ed 100644 --- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -1,5 +1,5 @@ /* Set the error indicator of a stream. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ #include @@ -23,19 +23,26 @@ #include "stdio-impl.h" +/* This file is not used on systems that have the __fseterr function, + namely musl libc. */ + void fseterr (FILE *fp) { /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ fp->_flags |= _IO_ERR_SEEN; -#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ +#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ fp_->_flags |= __SERR; #elif defined __EMX__ /* emx+gcc */ fp->_flags |= _IOERR; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +#elif defined __minix /* Minix */ + fp->_flags |= _IOERR; +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */ fp_->_flag |= _IOERR; #elif defined __UCLIBC__ /* uClibc */ fp->__modeflags |= __FLAG_ERROR; @@ -43,6 +50,9 @@ fseterr (FILE *fp) fp->_Mode |= 0x200 /* _MERR */; #elif defined __MINT__ /* Atari FreeMiNT */ fp->__error = 1; +#elif defined EPLAN9 /* Plan9 */ + if (fp->state != 0 /* CLOSED */) + fp->state = 5 /* ERR */; #elif 0 /* unknown */ /* Portable fallback, based on an idea by Rich Felker. Wow! 6 system calls for something that is just a bit operation!