Skip to content
Snippets Groups Projects
user avatar
Jonathan Wakely authored
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.
4065bf7c
History
Name Last commit Last update
..