Use correct format placeholder for WSAGetLastError()

Some code thought this was unsigned, but it's signed int.
This commit is contained in:
Peter Eisentraut 2021-04-23 13:27:01 +02:00
parent 6bbcff096f
commit 9486844f30
4 changed files with 6 additions and 6 deletions

View File

@ -1594,7 +1594,7 @@ pq_setkeepaliveswin32(Port *port, int idle, int interval)
!= 0)
{
ereport(LOG,
(errmsg("WSAIoctl(%s) failed: %ui",
(errmsg("WSAIoctl(%s) failed: %d",
"SIO_KEEPALIVE_VALS", WSAGetLastError())));
return STATUS_ERROR;
}

View File

@ -635,7 +635,7 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
{
ZeroMemory(&resEvents, sizeof(resEvents));
if (WSAEnumNetworkEvents(sockets[i], events[i], &resEvents) != 0)
elog(ERROR, "failed to enumerate network events: error code %u",
elog(ERROR, "failed to enumerate network events: error code %d",
WSAGetLastError());
/* Read activity? */
if (readfds && FD_ISSET(sockets[i], readfds))

View File

@ -1280,11 +1280,11 @@ WaitEventAdjustWin32(WaitEventSet *set, WaitEvent *event)
{
*handle = WSACreateEvent();
if (*handle == WSA_INVALID_EVENT)
elog(ERROR, "failed to create event for socket: error code %u",
elog(ERROR, "failed to create event for socket: error code %d",
WSAGetLastError());
}
if (WSAEventSelect(event->fd, *handle, flags) != 0)
elog(ERROR, "failed to set up event for socket: error code %u",
elog(ERROR, "failed to set up event for socket: error code %d",
WSAGetLastError());
Assert(event->fd != PGINVALID_SOCKET);
@ -1971,7 +1971,7 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
ZeroMemory(&resEvents, sizeof(resEvents));
if (WSAEnumNetworkEvents(cur_event->fd, handle, &resEvents) != 0)
elog(ERROR, "failed to enumerate network events: error code %u",
elog(ERROR, "failed to enumerate network events: error code %d",
WSAGetLastError());
if ((cur_event->events & WL_SOCKET_READABLE) &&
(resEvents.lNetworkEvents & FD_READ))

View File

@ -1985,7 +1985,7 @@ setKeepalivesWin32(PGconn *conn)
!= 0)
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui\n"),
libpq_gettext("WSAIoctl(SIO_KEEPALIVE_VALS) failed: %d\n"),
WSAGetLastError());
return 0;
}