Skip to content
Snippets Groups Projects
Unverified Commit 4065bf7c authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Jonathan Wakely
Browse files

libstdc++: Add workaround for read(2) EINVAL on macOS and FreeBSD [PR102259]

On macOS and FreeBSD the read(2) system call can return EINVAL for large
sizes, so limit the maximum that we try to read. The calling code in
basic_filebuf::xsgetn will loop until it gets the size it wants, so we don't
need to loop in basic_file::xsgetn, just limit the maximum size.

libstdc++-v3/ChangeLog:

	PR libstdc++/102259
	* config/io/basic_file_stdio.cc (basic_file::xsgetn): Limit n to
	_GLIBCXX_MAX_READ_SIZE if that macro is defined.
	* config/os/bsd/darwin/os_defines.h (_GLIBCXX_MAX_READ_SIZE):
	Define to INT_MAX-1.
	* config/os/bsd/freebsd/os_defines.h (_GLIBCXX_MAX_READ_SIZE):
	Likewise.
parent 80bb28cb
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment