select() generates "Invalid parameter" messages on Windows Vista.
The messages are generated by OutputDebugString() so are only visible
inside a debugger, or other debugger viewer applications.
The messages are generated by the _get_osfhandle() calls with invalid
file ids. This change makes sure it is only called when the corresponding
bit in the select() arguments has been set.
Related bug reports:
http://bugs.activestate.com/show_bug.cgi?id=82995
http://bugs.slimdevices.com/show_bug.cgi?id=11896
http://getpopfile.org/ticket/45
Even with this patch there are still residual "Invalid parameter" messages
in the debug output while building Perl itself. They are generated by
miniperl in the win32_fclose() function, again calling _get_osfhandle()
with an invalid handle. The same messages can be observed when Perl
is built *without* USE_PERLIO (just like miniperl).