I stumbled onto this while using freopen() for debugging purposes. Basically, freopen() fails if the FILE has been created with an invalid handle.
So, this MR contains: - basic tests for freopen (no issue there, just for coverage purposes) - tests for freopen on FILE with invalid handle - fix for freopen
-- v3: msvcrt: Fix freopen() on FILE with invalid underlying fd. msvcrt/tests: Add tests for freopen().