summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ferror.c
blob: 69ef439d3a9e55095fb43b793fe63f43d097be34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "__stdio.h" // for _IO_ERR
#include "stddef.h"  // for NULL

#include <libc.h>  // for __IMPL
#include <stdio.h> // for FILE, ferror

int ferror(FILE *stream)
{
	if (stream == NULL)
		return 0;

	return (__IMPL(stream)->flags & _IO_ERR) != 0;
}