diff options
Diffstat (limited to 'gl/fseterr.c')
| -rw-r--r-- | gl/fseterr.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gl/fseterr.c b/gl/fseterr.c index a01ef2af..0ab61765 100644 --- a/gl/fseterr.c +++ b/gl/fseterr.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Set the error indicator of a stream. | 1 | /* Set the error indicator of a stream. |
| 2 | Copyright (C) 2007-2025 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 |
| @@ -42,7 +42,7 @@ fseterr (FILE *fp) | |||
| 42 | fp->_flags |= _IOERR; | 42 | fp->_flags |= _IOERR; |
| 43 | #elif defined __minix /* Minix */ | 43 | #elif defined __minix /* Minix */ |
| 44 | fp->_flags |= _IOERR; | 44 | fp->_flags |= _IOERR; |
| 45 | #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ | 45 | #elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ |
| 46 | fp_->_flag |= _IOERR; | 46 | fp_->_flag |= _IOERR; |
| 47 | #elif defined __UCLIBC__ /* uClibc */ | 47 | #elif defined __UCLIBC__ /* uClibc */ |
| 48 | fp->__modeflags |= __FLAG_ERROR; | 48 | fp->__modeflags |= __FLAG_ERROR; |
| @@ -59,14 +59,10 @@ fseterr (FILE *fp) | |||
| 59 | Not activated on any system, because there is no way to repair FP when | 59 | Not activated on any system, because there is no way to repair FP when |
| 60 | the sequence of system calls fails, and library code should not call | 60 | the sequence of system calls fails, and library code should not call |
| 61 | abort(). */ | 61 | abort(). */ |
| 62 | int saved_errno; | 62 | int saved_errno = errno; |
| 63 | int fd; | ||
| 64 | int fd2; | ||
| 65 | |||
| 66 | saved_errno = errno; | ||
| 67 | fflush (fp); | 63 | fflush (fp); |
| 68 | fd = fileno (fp); | 64 | int fd = fileno (fp); |
| 69 | fd2 = dup (fd); | 65 | int fd2 = dup (fd); |
| 70 | if (fd2 >= 0) | 66 | if (fd2 >= 0) |
| 71 | { | 67 | { |
| 72 | close (fd); | 68 | close (fd); |
