Windows: tests: do not invoke syscalls on an invalid FDs
On Windows, calling fstat() on a FD that was already closed results in
calling the "invalid parameter handler".
Originally I created a proper set up for this to make sure that the code
won't leak a FD, but Michal prefers a saner approach of not testing for
Windows idiosyncrasies, which makes perfect sense to me.
diff --git a/tests/utests/basic/test_inout.c b/tests/utests/basic/test_inout.c
index b3b605f..da10568 100644
--- a/tests/utests/basic/test_inout.c
+++ b/tests/utests/basic/test_inout.c
@@ -68,10 +68,12 @@
/* fd1 is still open */
assert_int_equal(0, fstat(fd1, &statbuf));
close(fd1);
- /* but fd2 was closed by ly_in_free() */
+#ifndef _WIN32
+ /* But fd2 was closed by ly_in_free(). This results in an "invalid handler" on Windows. */
errno = 0;
assert_int_equal(-1, fstat(fd2, &statbuf));
assert_int_equal(errno, EBADF);
+#endif
}
static void