On arm, msvcrt.dll lacks the _setmaxstdio function; add a version allows setting it up to the current value of _getmaxstdio().
Signed-off-by: Martin Storsjö <[email protected]> --- gnulib contains calls to this function, as a part of an implementation of getdtablesize, used by gnulib's fcntl(). --- mingw-w64-crt/Makefile.am | 2 ++ mingw-w64-crt/stdio/_setmaxstdio.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 mingw-w64-crt/stdio/_setmaxstdio.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index b104da3a1..0e38a0be0 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -287,6 +287,7 @@ src_msvcrtarm32=\ misc/__p__fmode.c \ misc/__p__wcmdln.c \ misc/_getpid.c \ + stdio/_setmaxstdio.c \ stdio/gets.c if !ENABLE_SOFTMATH @@ -381,6 +382,7 @@ src_msvcrtarm64=\ misc/__p__fmode.c \ misc/__p__wcmdln.c \ misc/_getpid.c \ + stdio/_setmaxstdio.c \ stdio/gets.c src_msvcr80_64=\ diff --git a/mingw-w64-crt/stdio/_setmaxstdio.c b/mingw-w64-crt/stdio/_setmaxstdio.c new file mode 100644 index 000000000..9deb02651 --- /dev/null +++ b/mingw-w64-crt/stdio/_setmaxstdio.c @@ -0,0 +1,14 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <stdio.h> + +int __cdecl _setmaxstdio(int _Max) { + if (_Max < _IOB_ENTRIES || _Max > _getmaxstdio()) + return -1; + return _Max; +} +int __cdecl (*__MINGW_IMP_SYMBOL(_setmaxstdio))(int) = _setmaxstdio; -- 2.17.1 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
