Skip to content

Commit

Permalink
LibC: Implement __fseterr
Browse files Browse the repository at this point in the history
  • Loading branch information
timschumi authored and awesomekling committed Apr 3, 2022
1 parent 4f706d8 commit 3237efc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Userland/Libraries/LibC/bits/stdio_file_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct FILE {

int error() const { return m_error; }
void clear_err() { m_error = 0; }
void set_err() { m_error = 1; }

size_t read(u8*, size_t);
size_t write(u8 const*, size_t);
Expand Down
6 changes: 6 additions & 0 deletions Userland/Libraries/LibC/stdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,12 @@ void __freadptrinc(FILE* stream, size_t increment)

stream->readptr_increase(increment);
}

void __fseterr(FILE* stream)
{
ScopedFileLock lock(stream);
stream->set_err();
}
}

template bool FILE::gets<u8>(u8*, size_t);
Expand Down
1 change: 1 addition & 0 deletions Userland/Libraries/LibC/stdio_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ void __fpurge(FILE*);
size_t __freadahead(FILE*);
char const* __freadptr(FILE*, size_t*);
void __freadptrinc(FILE*, size_t);
void __fseterr(FILE*);

__END_DECLS

0 comments on commit 3237efc

Please sign in to comment.