[maint/v0.21] Fix build of tests with mingw

very, very partial backport of 2f795d8fc50d81641d95723d9ddd92795886bed3 to maint/v0.21 branch

without this include (or equivalent in some other location), O_RDWR and O_CREAT are undeclared when building tests/path/win32.c with mingw

ref #2766 for discussion