[05/11] libio: Add fseterr_unlocked for internal use

Message ID d5750f70f1dffd90ff58cd6b38f6b7118b643fb5.1594974444.git.fweimer@redhat.com
State New
Headers show
Series
  • Fix fgetsgent_r data corruption bug (20338)
Related show

Commit Message

Ben Woodard via Libc-alpha July 17, 2020, 8:30 a.m.
---
 include/stdio.h | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.26.2

Comments

Ben Woodard via Libc-alpha July 21, 2020, 3:27 a.m. | #1
On 7/17/20 4:30 AM, Florian Weimer via Libc-alpha wrote:

OK for 2.32.

Tested-by: Carlos O'Donell <carlos@redhat.com>

Reviewed-by: Carlos O'Donell <carlos@redhat.com>


> ---

>  include/stdio.h | 7 +++++++

>  1 file changed, 7 insertions(+)

> 

> diff --git a/include/stdio.h b/include/stdio.h

> index bc67d020d4..ede0f3d444 100644

> --- a/include/stdio.h

> +++ b/include/stdio.h

> @@ -31,6 +31,13 @@

>  #  define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)

>  # endif

>  

> +/* Set the error indicator on FP.  */

> +static inline void

> +fseterr_unlocked (FILE *fp)

> +{

> +  fp->_flags |= _IO_ERR_SEEN;

> +}

> +

>  extern int __fcloseall (void) attribute_hidden;

>  extern int __snprintf (char *__restrict __s, size_t __maxlen,

>  		       const char *__restrict __format, ...)

> 



-- 
Cheers,
Carlos.

Patch

diff --git a/include/stdio.h b/include/stdio.h
index bc67d020d4..ede0f3d444 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -31,6 +31,13 @@ 
 #  define stdio_hidden_ldbl_proto(p,f) libc_hidden_proto (p ## f)
 # endif
 
+/* Set the error indicator on FP.  */
+static inline void
+fseterr_unlocked (FILE *fp)
+{
+  fp->_flags |= _IO_ERR_SEEN;
+}
+
 extern int __fcloseall (void) attribute_hidden;
 extern int __snprintf (char *__restrict __s, size_t __maxlen,
 		       const char *__restrict __format, ...)