The reason to set SHELL_PATH and PERL_PATH was that 'make' failed to
execute
/bin/sh some-script
It turns out that different MinGW/MSYS environments have different
levels of support for this construct, so use the default and let the user
override the settings in config.mak if the defaults don't work.
As it turns out, the things returned by Winsock2's socket() are handles
that can be passed to ReadFile()/WriteFile() - almost. The way this works
is by wrapping those handles into file descriptors with _open_osfhandle().
But it turns out that the sockets created by the plain socket() function
are prepared for "overlapped" I/O, which confuses ReadFile()/WriteFile().
Therefore, a reimplementation is provided that uses WSASocket() to
explicitly asks for non-overlapped sockets.
Special thanks got to H. Peter Anvin, who provided the necessary clues.