On 13 April 2016 at 11:52, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Provide errno-translation wrappers around bind() and listen() on Windows.
>
> I've seen one too many "could not bind IPv4 socket: No error" log entries
> from the Windows buildfarm members. Per previous discussion, this is
> likely caused by the fact that we're doing nothing to translate
> WSAGetLastError() to errno. Put in a wrapper layer to do that.
>
> If this works as expected, it should get back-patched, but let's see what
> happens in the buildfarm first.
>
> Discussion: <4065.1452450340@sss.pgh.pa.us>
My windows machine gives me a bunch of new warnings with this:
src/backend/libpq/auth.c(1620): warning C4047: 'function' : 'int *'
differs in levels of indirection from 'size_t'
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/libpq/auth.c(1620): warning C4024: 'pgwin32_bind' :
different types for formal and actual parameter 3
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/libpq/auth.c(2606): warning C4047: 'function' : 'int *'
differs in levels of indirection from 'int'
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/libpq/auth.c(2606): warning C4024: 'pgwin32_bind' :
different types for formal and actual parameter 3
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/libpq/pqcomm.c(493): warning C4047: 'function' : 'int *'
differs in levels of indirection from 'size_t'
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/libpq/pqcomm.c(493): warning C4024: 'pgwin32_bind' :
different types for formal and actual parameter 3
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/port/win32/socket.c(272): warning C4047: 'function' :
'int' differs in levels of indirection from 'int *'
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/port/win32/socket.c(272): warning C4024: 'bind' :
different types for formal and actual parameter 3
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/postmaster/pgstat.c(396): warning C4047: 'function' :
'int *' differs in levels of indirection from 'size_t'
[L:\Projects\Postgres\a\postgres.vcxproj]
src/backend/postmaster/pgstat.c(396): warning C4024: 'pgwin32_bind'
: different types for formal and actual parameter 3
[L:\Projects\Postgres\a\postgres.vcxproj]
I'm not really sure why you made pgwin32_bind take a pointer to an
int, instead of just an int. I assume a mistake?
The attached fixes and gets rid of the warnings.