diff options
Diffstat (limited to 'libio/iofgets.c')
-rw-r--r-- | libio/iofgets.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libio/iofgets.c b/libio/iofgets.c index 6fd86eac75..68177dbe22 100644 --- a/libio/iofgets.c +++ b/libio/iofgets.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2016 Free Software Foundation, Inc. +/* Copyright (C) 1993-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,9 @@ #include <stdio.h> char * -_IO_fgets (char *buf, int n, _IO_FILE *fp) +_IO_fgets (char *buf, int n, FILE *fp) { - _IO_size_t count; + size_t count; char *result; int old_error; CHECK_FILE (fp, NULL); @@ -48,25 +48,23 @@ _IO_fgets (char *buf, int n, _IO_FILE *fp) /* This is very tricky since a file descriptor may be in the non-blocking mode. The error flag doesn't mean much in this case. We return an error only when there is a new error. */ - old_error = fp->_IO_file_flags & _IO_ERR_SEEN; - fp->_IO_file_flags &= ~_IO_ERR_SEEN; + old_error = fp->_flags & _IO_ERR_SEEN; + fp->_flags &= ~_IO_ERR_SEEN; count = _IO_getline (fp, buf, n - 1, '\n', 1); /* If we read in some bytes and errno is EAGAIN, that error will be reported for next read. */ - if (count == 0 || ((fp->_IO_file_flags & _IO_ERR_SEEN) - && errno != EAGAIN)) + if (count == 0 || ((fp->_flags & _IO_ERR_SEEN) && errno != EAGAIN)) result = NULL; else { buf[count] = '\0'; result = buf; } - fp->_IO_file_flags |= old_error; + fp->_flags |= old_error; _IO_release_lock (fp); return result; } -#ifdef weak_alias weak_alias (_IO_fgets, fgets) # ifndef _IO_MTSAFE_IO @@ -75,4 +73,3 @@ libc_hidden_def (__fgets_unlocked) weak_alias (_IO_fgets, fgets_unlocked) libc_hidden_weak (fgets_unlocked) # endif -#endif |