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

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

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

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