summaryrefslogtreecommitdiff
path: root/debug/fgets_u_chk.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/fgets_u_chk.c')
-rw-r--r--debug/fgets_u_chk.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/debug/fgets_u_chk.c b/debug/fgets_u_chk.c
index 99766fe354..924634c17b 100644
--- a/debug/fgets_u_chk.c
+++ b/debug/fgets_u_chk.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
@@ -29,9 +29,9 @@
#include <sys/param.h>
char *
-__fgets_unlocked_chk (char *buf, size_t size, int n, _IO_FILE *fp)
+__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp)
{
- _IO_size_t count;
+ size_t count;
char *result;
CHECK_FILE (fp, NULL);
if (n <= 0)
@@ -39,13 +39,12 @@ __fgets_unlocked_chk (char *buf, size_t size, 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. */
- int old_error = fp->_IO_file_flags & _IO_ERR_SEEN;
- fp->_IO_file_flags &= ~_IO_ERR_SEEN;
+ int old_error = fp->_flags & _IO_ERR_SEEN;
+ fp->_flags &= ~_IO_ERR_SEEN;
count = _IO_getline (fp, buf, MIN ((size_t) n - 1, size), '\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 if (count >= size)
__chk_fail ();
@@ -54,6 +53,6 @@ __fgets_unlocked_chk (char *buf, size_t size, int n, _IO_FILE *fp)
buf[count] = '\0';
result = buf;
}
- fp->_IO_file_flags |= old_error;
+ fp->_flags |= old_error;
return result;
}