1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Use consistent format for reporting GetLastError()

Use something like "error code %lu" for reporting GetLastError()
values on Windows.  Previously, a mix of different wordings and
formats were in use.
This commit is contained in:
Peter Eisentraut
2011-08-23 22:00:52 +03:00
parent 6c6a415333
commit 1af55e2751
18 changed files with 132 additions and 132 deletions

View File

@@ -1405,8 +1405,8 @@ pg_SSPI_recvauth(Port *port)
secur32 = LoadLibrary("SECUR32.DLL");
if (secur32 == NULL)
ereport(ERROR,
(errmsg_internal("could not load secur32.dll: %d",
(int) GetLastError())));
(errmsg_internal("could not load secur32.dll: error code %lu",
GetLastError())));
_QuerySecurityContextToken = (QUERY_SECURITY_CONTEXT_TOKEN_FN)
GetProcAddress(secur32, "QuerySecurityContextToken");
@@ -1414,8 +1414,8 @@ pg_SSPI_recvauth(Port *port)
{
FreeLibrary(secur32);
ereport(ERROR,
(errmsg_internal("could not locate QuerySecurityContextToken in secur32.dll: %d",
(int) GetLastError())));
(errmsg_internal("could not locate QuerySecurityContextToken in secur32.dll: error code %lu",
GetLastError())));
}
r = (_QuerySecurityContextToken) (sspictx, &token);
@@ -1437,8 +1437,8 @@ pg_SSPI_recvauth(Port *port)
if (!GetTokenInformation(token, TokenUser, NULL, 0, &retlen) && GetLastError() != 122)
ereport(ERROR,
(errmsg_internal("could not get token user size: error code %d",
(int) GetLastError())));
(errmsg_internal("could not get token user size: error code %lu",
GetLastError())));
tokenuser = malloc(retlen);
if (tokenuser == NULL)
@@ -1447,14 +1447,14 @@ pg_SSPI_recvauth(Port *port)
if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen))
ereport(ERROR,
(errmsg_internal("could not get user token: error code %d",
(int) GetLastError())));
(errmsg_internal("could not get user token: error code %lu",
GetLastError())));
if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize,
domainname, &domainnamesize, &accountnameuse))
ereport(ERROR,
(errmsg_internal("could not look up account SID: error code %d",
(int) GetLastError())));
(errmsg_internal("could not look up account SID: error code %lu",
GetLastError())));
free(tokenuser);

View File

@@ -144,8 +144,8 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo)
NULL);
if (dumpFile == INVALID_HANDLE_VALUE)
{
write_stderr("could not open crash dump file \"%s\" for writing: error code %u\n",
dumpPath, (unsigned int) GetLastError());
write_stderr("could not open crash dump file \"%s\" for writing: error code %lu\n",
dumpPath, GetLastError());
return EXCEPTION_CONTINUE_SEARCH;
}
@@ -153,8 +153,8 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo)
NULL, NULL))
write_stderr("wrote crash dump to file \"%s\"\n", dumpPath);
else
write_stderr("could not write crash dump to file \"%s\": error code %08x\n",
dumpPath, (unsigned int) GetLastError());
write_stderr("could not write crash dump to file \"%s\": error code %lu\n",
dumpPath, GetLastError());
CloseHandle(dumpFile);
}

View File

@@ -42,8 +42,8 @@ LoadKernel32()
kernel32 = LoadLibraryEx("kernel32.dll", NULL, 0);
if (kernel32 == NULL)
ereport(FATAL,
(errmsg_internal("could not load kernel32.dll: %d",
(int) GetLastError())));
(errmsg_internal("could not load kernel32.dll: error code %lu",
GetLastError())));
}
@@ -73,8 +73,8 @@ RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
if (_RegisterWaitForSingleObject == NULL)
ereport(FATAL,
(errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: %d",
(int) GetLastError())));
(errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: error code %lu",
GetLastError())));
}
return (_RegisterWaitForSingleObject)

View File

@@ -40,8 +40,8 @@ pgwin32_is_admin(void)
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &AccessToken))
{
write_stderr("could not open process token: error code %d\n",
(int) GetLastError());
write_stderr("could not open process token: error code %lu\n",
GetLastError());
exit(1);
}
@@ -60,8 +60,8 @@ pgwin32_is_admin(void)
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0,
0, &AdministratorsSid))
{
write_stderr("could not get SID for Administrators group: error code %d\n",
(int) GetLastError());
write_stderr("could not get SID for Administrators group: error code %lu\n",
GetLastError());
exit(1);
}
@@ -69,8 +69,8 @@ pgwin32_is_admin(void)
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0,
0, &PowerUsersSid))
{
write_stderr("could not get SID for PowerUsers group: error code %d\n",
(int) GetLastError());
write_stderr("could not get SID for PowerUsers group: error code %lu\n",
GetLastError());
exit(1);
}
@@ -129,8 +129,8 @@ pgwin32_is_service(void)
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &AccessToken))
{
fprintf(stderr, "could not open process token: error code %d\n",
(int) GetLastError());
fprintf(stderr, "could not open process token: error code %lu\n",
GetLastError());
return -1;
}
@@ -223,8 +223,8 @@ pgwin32_get_dynamic_tokeninfo(HANDLE token, TOKEN_INFORMATION_CLASS class,
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
snprintf(errbuf, errsize, "could not get token information: error code %d\n",
(int) GetLastError());
snprintf(errbuf, errsize, "could not get token information: error code %lu\n",
GetLastError());
return FALSE;
}
@@ -239,8 +239,8 @@ pgwin32_get_dynamic_tokeninfo(HANDLE token, TOKEN_INFORMATION_CLASS class,
if (!GetTokenInformation(token, class, *InfoBuffer,
InfoBufferSize, &InfoBufferSize))
{
snprintf(errbuf, errsize, "could not get token information: error code %d\n",
(int) GetLastError());
snprintf(errbuf, errsize, "could not get token information: error code %lu\n",
GetLastError());
return FALSE;
}

View File

@@ -83,7 +83,7 @@ pgwin32_signal_initialize(void)
pgwin32_signal_event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (pgwin32_signal_event == NULL)
ereport(FATAL,
(errmsg_internal("could not create signal event: %d", (int) GetLastError())));
(errmsg_internal("could not create signal event: error code %lu", GetLastError())));
/* Create thread for handling signals */
signal_thread_handle = CreateThread(NULL, 0, pg_signal_thread, NULL, 0, NULL);
@@ -186,8 +186,8 @@ pgwin32_create_signal_listener(pid_t pid)
if (pipe == INVALID_HANDLE_VALUE)
ereport(ERROR,
(errmsg("could not create signal listener pipe for PID %d: error code %d",
(int) pid, (int) GetLastError())));
(errmsg("could not create signal listener pipe for PID %d: error code %lu",
(int) pid, GetLastError())));
return pipe;
}
@@ -266,7 +266,7 @@ pg_signal_thread(LPVOID param)
if (pipe == INVALID_HANDLE_VALUE)
{
write_stderr("could not create signal listener pipe: error code %d; retrying\n", (int) GetLastError());
write_stderr("could not create signal listener pipe: error code %lu; retrying\n", GetLastError());
SleepEx(500, FALSE);
continue;
}
@@ -298,7 +298,7 @@ pg_signal_thread(LPVOID param)
* is nothing else we can do other than abort the whole
* process which will be even worse.
*/
write_stderr("could not create signal listener pipe: error code %d; retrying\n", (int) GetLastError());
write_stderr("could not create signal listener pipe: error code %lu; retrying\n", GetLastError());
/*
* Keep going so we at least dispatch this signal. Hopefully,
@@ -309,8 +309,8 @@ pg_signal_thread(LPVOID param)
(LPTHREAD_START_ROUTINE) pg_signal_dispatch_thread,
(LPVOID) pipe, 0, NULL);
if (hThread == INVALID_HANDLE_VALUE)
write_stderr("could not create signal dispatch thread: error code %d\n",
(int) GetLastError());
write_stderr("could not create signal dispatch thread: error code %lu\n",
GetLastError());
else
CloseHandle(hThread);

View File

@@ -143,11 +143,11 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
if (waitevent == INVALID_HANDLE_VALUE)
ereport(ERROR,
(errmsg_internal("could not create socket waiting event: %d", (int) GetLastError())));
(errmsg_internal("could not create socket waiting event: error code %lu", GetLastError())));
}
else if (!ResetEvent(waitevent))
ereport(ERROR,
(errmsg_internal("could not reset socket waiting event: %d", (int) GetLastError())));
(errmsg_internal("could not reset socket waiting event: error code %lu", GetLastError())));
/*
* make sure we don't multiplex this kernel event object with a different
@@ -221,7 +221,7 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
if (r == WAIT_TIMEOUT)
return 0;
ereport(ERROR,
(errmsg_internal("unrecognized return value from WaitForMultipleObjects: %d (%d)", r, (int) GetLastError())));
(errmsg_internal("unrecognized return value from WaitForMultipleObjects: %d (%lu)", r, GetLastError())));
return 0;
}
@@ -567,7 +567,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) == SOCKET_ERROR)
ereport(FATAL,
(errmsg_internal("failed to enumerate network events: %d", (int) GetLastError())));
(errmsg_internal("failed to enumerate network events: error code %lu", GetLastError())));
/* Read activity? */
if (readfds && FD_ISSET(sockets[i], readfds))
{
@@ -645,7 +645,7 @@ pgwin32_socket_strerror(int err)
handleDLL = LoadLibraryEx("netmsg.dll", NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
if (handleDLL == NULL)
ereport(FATAL,
(errmsg_internal("could not load netmsg.dll: %d", (int) GetLastError())));
(errmsg_internal("could not load netmsg.dll: error code %lu", GetLastError())));
}
ZeroMemory(&wserrbuf, sizeof(wserrbuf));

View File

@@ -97,8 +97,8 @@ setitimer(int which, const struct itimerval * value, struct itimerval * ovalue)
timerCommArea.event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (timerCommArea.event == NULL)
ereport(FATAL,
(errmsg_internal("could not create timer event: %d",
(int) GetLastError())));
(errmsg_internal("could not create timer event: error code %lu",
GetLastError())));
MemSet(&timerCommArea.value, 0, sizeof(struct itimerval));
@@ -107,8 +107,8 @@ setitimer(int which, const struct itimerval * value, struct itimerval * ovalue)
timerThreadHandle = CreateThread(NULL, 0, pg_timer_thread, NULL, 0, NULL);
if (timerThreadHandle == INVALID_HANDLE_VALUE)
ereport(FATAL,
(errmsg_internal("could not create timer thread: %d",
(int) GetLastError())));
(errmsg_internal("could not create timer thread: error code %lu",
GetLastError())));
}
/* Request the timer thread to change settings */

View File

@@ -38,7 +38,7 @@ InitLatch(volatile Latch *latch)
latch->event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (latch->event == NULL)
elog(ERROR, "CreateEvent failed: error code %d", (int) GetLastError());
elog(ERROR, "CreateEvent failed: error code %lu", GetLastError());
}
void
@@ -59,7 +59,7 @@ InitSharedLatch(volatile Latch *latch)
latch->event = CreateEvent(&sa, TRUE, FALSE, NULL);
if (latch->event == NULL)
elog(ERROR, "CreateEvent failed: error code %d", (int) GetLastError());
elog(ERROR, "CreateEvent failed: error code %lu", GetLastError());
}
void
@@ -150,7 +150,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
* will return immediately.
*/
if (!ResetEvent(latchevent))
elog(ERROR, "ResetEvent failed: error code %d", (int) GetLastError());
elog(ERROR, "ResetEvent failed: error code %lu", GetLastError());
if ((wakeEvents & WL_LATCH_SET) && latch->is_set)
{
result |= WL_LATCH_SET;
@@ -164,7 +164,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
rc = WaitForMultipleObjects(numevents, events, FALSE, timeout);
if (rc == WAIT_FAILED)
elog(ERROR, "WaitForMultipleObjects() failed: error code %d", (int) GetLastError());
elog(ERROR, "WaitForMultipleObjects() failed: error code %lu", GetLastError());
/* Participate in Windows signal emulation */
else if (rc == WAIT_OBJECT_0 + 1)
@@ -188,7 +188,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
ZeroMemory(&resEvents, sizeof(resEvents));
if (WSAEnumNetworkEvents(sock, sockevent, &resEvents) == SOCKET_ERROR)
ereport(FATAL,
(errmsg_internal("failed to enumerate network events: %d", (int) GetLastError())));
(errmsg_internal("failed to enumerate network events: error code %lu", GetLastError())));
if ((wakeEvents & WL_SOCKET_READABLE) &&
(resEvents.lNetworkEvents & FD_READ))
@@ -203,7 +203,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
}
/* Otherwise it must be the latch event */
else if (rc != WAIT_OBJECT_0)
elog(ERROR, "unexpected return code from WaitForMultipleObjects(): %d", (int) rc);
elog(ERROR, "unexpected return code from WaitForMultipleObjects(): %lu", rc);
}
while (result == 0);

View File

@@ -91,7 +91,7 @@ PGSemaphoreCreate(PGSemaphore sema)
}
else
ereport(PANIC,
(errmsg("could not create semaphore: error code %d", (int) GetLastError())));
(errmsg("could not create semaphore: error code %lu", GetLastError())));
}
/*
@@ -158,7 +158,7 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
if (errno != 0)
ereport(FATAL,
(errmsg("could not lock semaphore: error code %d", (int) GetLastError())));
(errmsg("could not lock semaphore: error code %lu", GetLastError())));
}
/*
@@ -171,7 +171,7 @@ PGSemaphoreUnlock(PGSemaphore sema)
{
if (!ReleaseSemaphore(*sema, 1, NULL))
ereport(FATAL,
(errmsg("could not unlock semaphore: error code %d", (int) GetLastError())));
(errmsg("could not unlock semaphore: error code %lu", GetLastError())));
}
/*
@@ -200,7 +200,7 @@ PGSemaphoreTryLock(PGSemaphore sema)
/* Otherwise we are in trouble */
ereport(FATAL,
(errmsg("could not try-lock semaphore: error code %d", (int) GetLastError())));
(errmsg("could not try-lock semaphore: error code %lu", GetLastError())));
/* keep compiler quiet */
return false;

View File

@@ -45,7 +45,7 @@ GetSharedMemName(void)
bufsize = GetFullPathName(DataDir, 0, NULL, NULL);
if (bufsize == 0)
elog(FATAL, "could not get size for full pathname of datadir %s: %lu",
elog(FATAL, "could not get size for full pathname of datadir %s: error code %lu",
DataDir, GetLastError());
retptr = malloc(bufsize + 18); /* 18 for Global\PostgreSQL: */
@@ -55,7 +55,7 @@ GetSharedMemName(void)
strcpy(retptr, "Global\\PostgreSQL:");
r = GetFullPathName(DataDir, bufsize, retptr + 18, NULL);
if (r == 0 || r > bufsize)
elog(FATAL, "could not generate full pathname for datadir %s: %lu",
elog(FATAL, "could not generate full pathname for datadir %s: error code %lu",
DataDir, GetLastError());
/*
@@ -165,7 +165,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
if (!hmap)
ereport(FATAL,
(errmsg("could not create shared memory segment: %lu", GetLastError()),
(errmsg("could not create shared memory segment: error code %lu", GetLastError()),
errdetail("Failed system call was CreateFileMapping(size=%lu, name=%s).",
(unsigned long) size, szShareMem)));
@@ -200,7 +200,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
*/
if (!DuplicateHandle(GetCurrentProcess(), hmap, GetCurrentProcess(), &hmap2, 0, TRUE, DUPLICATE_SAME_ACCESS))
ereport(FATAL,
(errmsg("could not create shared memory segment: %lu", GetLastError()),
(errmsg("could not create shared memory segment: error code %lu", GetLastError()),
errdetail("Failed system call was DuplicateHandle.")));
/*
@@ -208,7 +208,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
* care.
*/
if (!CloseHandle(hmap))
elog(LOG, "could not close handle to shared memory: %lu", GetLastError());
elog(LOG, "could not close handle to shared memory: error code %lu", GetLastError());
/* Register on-exit routine to delete the new segment */
@@ -221,7 +221,7 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
memAddress = MapViewOfFileEx(hmap2, FILE_MAP_WRITE | FILE_MAP_READ, 0, 0, 0, NULL);
if (!memAddress)
ereport(FATAL,
(errmsg("could not create shared memory segment: %lu", GetLastError()),
(errmsg("could not create shared memory segment: error code %lu", GetLastError()),
errdetail("Failed system call was MapViewOfFileEx.")));
@@ -272,12 +272,12 @@ PGSharedMemoryReAttach(void)
* Release memory region reservation that was made by the postmaster
*/
if (VirtualFree(UsedShmemSegAddr, 0, MEM_RELEASE) == 0)
elog(FATAL, "failed to release reserved memory region (addr=%p): %lu",
elog(FATAL, "failed to release reserved memory region (addr=%p): error code %lu",
UsedShmemSegAddr, GetLastError());
hdr = (PGShmemHeader *) MapViewOfFileEx(UsedShmemSegID, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0, UsedShmemSegAddr);
if (!hdr)
elog(FATAL, "could not reattach to shared memory (key=%p, addr=%p): %lu",
elog(FATAL, "could not reattach to shared memory (key=%p, addr=%p): error code %lu",
UsedShmemSegID, UsedShmemSegAddr, GetLastError());
if (hdr != origUsedShmemSegAddr)
elog(FATAL, "reattaching to shared memory returned unexpected address (got %p, expected %p)",
@@ -302,7 +302,7 @@ PGSharedMemoryDetach(void)
if (UsedShmemSegAddr != NULL)
{
if (!UnmapViewOfFile(UsedShmemSegAddr))
elog(LOG, "could not unmap view of shared memory: %lu", GetLastError());
elog(LOG, "could not unmap view of shared memory: error code %lu", GetLastError());
UsedShmemSegAddr = NULL;
}
@@ -318,7 +318,7 @@ pgwin32_SharedMemoryDelete(int status, Datum shmId)
{
PGSharedMemoryDetach();
if (!CloseHandle(DatumGetPointer(shmId)))
elog(LOG, "could not close handle to shared memory: %lu", GetLastError());
elog(LOG, "could not close handle to shared memory: error code %lu", GetLastError());
}
/*
@@ -351,7 +351,7 @@ pgwin32_ReserveSharedMemoryRegion(HANDLE hChild)
if (address == NULL)
{
/* Don't use FATAL since we're running in the postmaster */
elog(LOG, "could not reserve shared memory region (addr=%p) for child %p: %lu",
elog(LOG, "could not reserve shared memory region (addr=%p) for child %p: error code %lu",
UsedShmemSegAddr, hChild, GetLastError());
return false;
}

View File

@@ -3705,16 +3705,16 @@ internal_forkexec(int argc, char *argv[], Port *port)
NULL);
if (paramHandle == INVALID_HANDLE_VALUE)
{
elog(LOG, "could not create backend parameter file mapping: error code %d",
(int) GetLastError());
elog(LOG, "could not create backend parameter file mapping: error code %lu",
GetLastError());
return -1;
}
param = MapViewOfFile(paramHandle, FILE_MAP_WRITE, 0, 0, sizeof(BackendParameters));
if (!param)
{
elog(LOG, "could not map backend parameter memory: error code %d",
(int) GetLastError());
elog(LOG, "could not map backend parameter memory: error code %lu",
GetLastError());
CloseHandle(paramHandle);
return -1;
}
@@ -3754,8 +3754,8 @@ internal_forkexec(int argc, char *argv[], Port *port)
if (!CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, CREATE_SUSPENDED,
NULL, NULL, &si, &pi))
{
elog(LOG, "CreateProcess call failed: %m (error code %d)",
(int) GetLastError());
elog(LOG, "CreateProcess call failed: %m (error code %lu)",
GetLastError());
return -1;
}
@@ -3767,8 +3767,8 @@ internal_forkexec(int argc, char *argv[], Port *port)
*/
if (!TerminateProcess(pi.hProcess, 255))
ereport(LOG,
(errmsg_internal("could not terminate unstarted process: error code %d",
(int) GetLastError())));
(errmsg_internal("could not terminate unstarted process: error code %lu",
GetLastError())));
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return -1; /* log made by save_backend_variables */
@@ -3776,11 +3776,11 @@ internal_forkexec(int argc, char *argv[], Port *port)
/* Drop the parameter shared memory that is now inherited to the backend */
if (!UnmapViewOfFile(param))
elog(LOG, "could not unmap view of backend parameter file: error code %d",
(int) GetLastError());
elog(LOG, "could not unmap view of backend parameter file: error code %lu",
GetLastError());
if (!CloseHandle(paramHandle))
elog(LOG, "could not close handle to backend parameter file: error code %d",
(int) GetLastError());
elog(LOG, "could not close handle to backend parameter file: error code %lu",
GetLastError());
/*
* Reserve the memory region used by our main shared memory segment before
@@ -3794,8 +3794,8 @@ internal_forkexec(int argc, char *argv[], Port *port)
*/
if (!TerminateProcess(pi.hProcess, 255))
ereport(LOG,
(errmsg_internal("could not terminate process that failed to reserve memory: error code %d",
(int) GetLastError())));
(errmsg_internal("could not terminate process that failed to reserve memory: error code %lu",
GetLastError())));
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return -1; /* logging done made by
@@ -3812,8 +3812,8 @@ internal_forkexec(int argc, char *argv[], Port *port)
if (!TerminateProcess(pi.hProcess, 255))
{
ereport(LOG,
(errmsg_internal("could not terminate unstartable process: error code %d",
(int) GetLastError())));
(errmsg_internal("could not terminate unstartable process: error code %lu",
GetLastError())));
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return -1;
@@ -3821,8 +3821,8 @@ internal_forkexec(int argc, char *argv[], Port *port)
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
ereport(LOG,
(errmsg_internal("could not resume thread of unstarted process: error code %d",
(int) GetLastError())));
(errmsg_internal("could not resume thread of unstarted process: error code %lu",
GetLastError())));
return -1;
}
@@ -3850,8 +3850,8 @@ internal_forkexec(int argc, char *argv[], Port *port)
INFINITE,
WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
ereport(FATAL,
(errmsg_internal("could not register process for wait: error code %d",
(int) GetLastError())));
(errmsg_internal("could not register process for wait: error code %lu",
GetLastError())));
/* Don't close pi.hProcess here - the wait thread needs access to it */
@@ -4710,8 +4710,8 @@ write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE childProcess)
DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS))
{
ereport(LOG,
(errmsg_internal("could not duplicate handle to be written to backend parameter file: error code %d",
(int) GetLastError())));
(errmsg_internal("could not duplicate handle to be written to backend parameter file: error code %lu",
GetLastError())));
return false;
}
@@ -4830,8 +4830,8 @@ read_backend_variables(char *id, Port *port)
paramp = MapViewOfFile(paramHandle, FILE_MAP_READ, 0, 0, 0);
if (!paramp)
{
write_stderr("could not map view of backend variables: error code %d\n",
(int) GetLastError());
write_stderr("could not map view of backend variables: error code %lu\n",
GetLastError());
exit(1);
}
@@ -4839,15 +4839,15 @@ read_backend_variables(char *id, Port *port)
if (!UnmapViewOfFile(paramp))
{
write_stderr("could not unmap view of backend variables: error code %d\n",
(int) GetLastError());
write_stderr("could not unmap view of backend variables: error code %lu\n",
GetLastError());
exit(1);
}
if (!CloseHandle(paramHandle))
{
write_stderr("could not close handle to backend parameter variables: error code %d\n",
(int) GetLastError());
write_stderr("could not close handle to backend parameter variables: error code %lu\n",
GetLastError());
exit(1);
}
#endif
@@ -5063,7 +5063,7 @@ InitPostmasterDeathWatchHandle(void)
TRUE,
DUPLICATE_SAME_ACCESS) == 0)
ereport(FATAL,
(errmsg_internal("could not duplicate postmaster handle: error code %d",
(int) GetLastError())));
(errmsg_internal("could not duplicate postmaster handle: error code %lu",
GetLastError())));
#endif /* WIN32 */
}

View File

@@ -559,7 +559,7 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm
len = WideCharToMultiByte(CP_UTF8, 0, wbuf, len, dst, dstlen, NULL, NULL);
if (len == 0)
elog(ERROR,
"could not convert string to UTF-8:error %lu", GetLastError());
"could not convert string to UTF-8: error code %lu", GetLastError());
dst[len] = '\0';
if (encoding != PG_UTF8)

View File

@@ -1355,7 +1355,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
(LPWSTR) a1p, a1len / 2);
if (!r)
ereport(ERROR,
(errmsg("could not convert string to UTF-16: error %lu",
(errmsg("could not convert string to UTF-16: error code %lu",
GetLastError())));
}
((LPWSTR) a1p)[r] = 0;
@@ -1368,7 +1368,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid)
(LPWSTR) a2p, a2len / 2);
if (!r)
ereport(ERROR,
(errmsg("could not convert string to UTF-16: error %lu",
(errmsg("could not convert string to UTF-16: error code %lu",
GetLastError())));
}
((LPWSTR) a2p)[r] = 0;