My knowledge of Windows is really superficial, but as far as I understand it these fds are not really file descriptors, but OS handles, so they should be closed with CloseHandle().
Replacing every close() with CloseHandle() (by creating a new define in dropin.h) seems to do the trick (except for cross-compilation to x86, there are other issues there).
I'd like to finish the test suite first so I didn't look too much into it. Maybe some of those fds really are fds.
How to reproduce them:
meson setup vs --backend vs -Dbuildtype=debug
, build ittinc stop
in a separate command line prompt, the process you're debugging should fail with an errortincd
separately before that, and debug tinc with astop
argumentThey both crash with the same message:
and then
These values always seem to be way higher than the maximum possible 64 (at least in the 300-400 range).
I tracked these messages down to here:
https://github.com/gsliepen/tinc/blob/50c62f7235eacd3b88c59ead983e8be719fb7604/src/tincctl.c#L647
https://github.com/gsliepen/tinc/blob/50c62f7235eacd3b88c59ead983e8be719fb7604/src/net_setup.c#L1184
and at least a few other places.
My knowledge of Windows is really superficial, but as far as I understand it these
fd
s are not really file descriptors, but OS handles, so they should be closed withCloseHandle()
.Replacing every
close()
withCloseHandle()
(by creating a new define indropin.h
) seems to do the trick (except for cross-compilation to x86, there are other issues there).I'd like to finish the test suite first so I didn't look too much into it. Maybe some of those
fd
s really are fds.