Skip to content

Clean up Windows Invalid Parameter Handler setup and fix fileutils test

Chun-wei Fan requested to merge fix-fileutils-test into main

Hi,

This MR attempts to fix issue #2800 (closed) since we need to tell the Windows CRT to not abort() the program when we try to use g_fsync() to check that the file descriptor is indeed invalidated, since the underlying _commit() call on Windows in g_fsync() does not otherwise like it when one calls it with an invalidated file descriptor, as in 1, since the Visual Studio 2005 CRT. In the same process, we also attempt to consolidate the code to setup the invalid parameter handler for gspawn-win32-helper.c, gmessages.c, and for fixing the test program, fileutils.c, by using two private APIs.

This will probably need to be expanded further for MSYS2 builds as they transition to use the UCRT, but checking for such cross-compiler builds is beyond my knowledge on the MSYS2 toolchain.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports