Windows has different definitions of `struct stat`. The difference between those structs is that they either use 32 or 64 bit timestamps and/or filesizes. In the clar we try to set that up automatically, but the logic to do so is somewhat convoluted and really fragile. Refactor the code such that we always define the `stat()` function and its structure together, which is both easier to understand and less fragile. Signed-off-by: Patrick Steinhardt <ps@xxxxxx> --- t/unit-tests/clar/clar.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c index f463ee823a..12fa66d088 100644 --- a/t/unit-tests/clar/clar.c +++ b/t/unit-tests/clar/clar.c @@ -30,6 +30,9 @@ # ifndef stat # define stat(path, st) _stat(path, st) + typedef struct _stat STAT_T; +# else + typedef struct stat STAT_T; # endif # ifndef mkdir # define mkdir(path, mode) _mkdir(path) @@ -62,12 +65,6 @@ # else # define p_snprintf snprintf # endif - -# if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)) - typedef struct stat STAT_T; -# else - typedef struct _stat STAT_T; -# endif #else # include <sys/wait.h> /* waitpid(2) */ # include <unistd.h> -- 2.47.0.rc0.dirty