index 1b6399d91da577bd32405b46b28e95aa799c2a10..ca2bba99d8cfd556fd51441b9709c8e109df6dd5 100644 (file)
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");
{
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);
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)
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);
index b905206a29a710d4243ae290bbed6edf97e553d4..d3ed181f23b316ae569db2a09198b962823c48df 100644 (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);
}
index e12aca3d708ffedf30df860885d3d233694c1a93..d83299ef5d812a95cb725b0c7e954d57c2b5787f 100644 (file)
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)
index e2a2406fe608ecff0115a6cf6852fa87d4ff5142..8e1f17ec0184e4e0f2675beb63adb849051b012d 100644 (file)
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);
}
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);
}
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);
}
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;
}
index d2dfd01223c291ae891c28263015e33e61993082..cf39253d03401c946deadd99ca01a01aa89f6167 100644 (file)
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;
}
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;
}
* 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,
(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);
index 2649268c18d450bbf44e4b35768bd9661bf3d7e0..be741af4bed5cbf2b437b3de7a7120e6bf565140 100644 (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))
{
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));
index 97224df386b80aa51119349ece81a5b24d447b85..41379c73624cebfb769477d1784a1b37799933d3 100644 (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 */
index 10a400670149d8cf29f731a5ef04d58d42220f03..3a61cb67669271493ed74a66457d751688619ed0 100644 (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);
index 8c364dfe88dd9ef9ae3ed3bb3052b3064705315a..d6f31cf82727abb1d93d045e1dbe6eb6ca6a9c95 100644 (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())));
}
/*
{
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())));
}
/*
/* 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;
index 1a2ee12dcb063c838716e70f642da4d41238d3e5..97f4d706d17fbfd7f51dfdab8b7588c722bfdccd 100644 (file)
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: */
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.")));
* 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)",
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;
}
index c0a32a396c6b102c16760442651ec6cf3909ac66..6e231a538f492c8c1e4193c80b25c94325745cee 100644 (file)
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 */
/* 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;
}
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);
}
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
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 */
}
index cf663466c354bcbbcf8c066bbbc1ffae23cbf86d..4a2fd28f475a9c10a518ab1a42c1f3866c94bc5e 100644 (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)
index 3677b1c3bbc0f7ff05932feb53504239554ffc58..cdeee6b8e7efe6d33611700a3a8ca12e7b009fdc 100644 (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;
index 399c734bc955e1f59bae8907944d95b3d60343d1..c3173558945ae32d1679f3439e2d5af952b2442f 100644 (file)
@@ -2444,7 +2444,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
/* Open the current token to use as a base for the restricted one */
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &origToken))
{
- fprintf(stderr, "Failed to open process token: %lu\n", GetLastError());
+ fprintf(stderr, "Failed to open process token: error code %lu\n", GetLastError());
return 0;
}
@@ -2457,7 +2457,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0,
0, &dropSids[1].Sid))
{
- fprintf(stderr, "Failed to allocate SIDs: %lu\n", GetLastError());
+ fprintf(stderr, "Failed to allocate SIDs: error code %lu\n", GetLastError());
return 0;
}
@@ -2476,7 +2476,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
if (!b)
{
- fprintf(stderr, "Failed to create restricted token: %lu\n", GetLastError());
+ fprintf(stderr, "Failed to create restricted token: error code %lu\n", GetLastError());
return 0;
}
@@ -2497,7 +2497,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
processInfo))
{
- fprintf(stderr, "CreateProcessAsUser failed: %lu\n", GetLastError());
+ fprintf(stderr, "CreateProcessAsUser failed: error code %lu\n", GetLastError());
return 0;
}
if (!CreateRestrictedProcess(cmdline, &pi))
{
- fprintf(stderr, "Failed to re-exec with restricted token: %lu.\n", GetLastError());
+ fprintf(stderr, "Failed to re-exec with restricted token: error code %lu\n", GetLastError());
}
else
{
if (!GetExitCodeProcess(pi.hProcess, &x))
{
- fprintf(stderr, "Failed to get exit code from subprocess: %lu\n", GetLastError());
+ fprintf(stderr, "Failed to get exit code from subprocess: error code %lu\n", GetLastError());
exit(1);
}
exit(x);
index 2c78c087bbcfe10e6656fd2f5aa9856645ab25d6..0dbdfe7312cbe9ccad67b26d2e857dd19066d1c7 100644 (file)
NULL, NULL, "RPCSS0円", register_username, register_password)) == NULL)
{
CloseServiceHandle(hSCM);
- write_stderr(_("%s: could not register service \"%s\": error code %d\n"), progname, register_servicename, (int) GetLastError());
+ write_stderr(_("%s: could not register service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
exit(1);
}
CloseServiceHandle(hService);
if ((hService = OpenService(hSCM, register_servicename, DELETE)) == NULL)
{
CloseServiceHandle(hSCM);
- write_stderr(_("%s: could not open service \"%s\": error code %d\n"), progname, register_servicename, (int) GetLastError());
+ write_stderr(_("%s: could not open service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
exit(1);
}
if (!DeleteService(hService))
{
CloseServiceHandle(hService);
CloseServiceHandle(hSCM);
- write_stderr(_("%s: could not unregister service \"%s\": error code %d\n"), progname, register_servicename, (int) GetLastError());
+ write_stderr(_("%s: could not unregister service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
exit(1);
}
CloseServiceHandle(hService);
if (StartServiceCtrlDispatcher(st) == 0)
{
- write_stderr(_("%s: could not start service \"%s\": error code %d\n"), progname, register_servicename, (int) GetLastError());
+ write_stderr(_("%s: could not start service \"%s\": error code %lu\n"), progname, register_servicename, GetLastError());
exit(1);
}
}
@@ -1579,7 +1579,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
/* Open the current token to use as a base for the restricted one */
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &origToken))
{
- write_stderr(_("%s: could not open process token: %lu\n"), progname, GetLastError());
+ write_stderr(_("%s: could not open process token: error code %lu\n"), progname, GetLastError());
return 0;
}
@@ -1592,7 +1592,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0,
0, &dropSids[1].Sid))
{
- write_stderr(_("%s: could not allocate SIDs: %lu\n"), progname, GetLastError());
+ write_stderr(_("%s: could not allocate SIDs: error code %lu\n"), progname, GetLastError());
return 0;
}
@@ -1611,7 +1611,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
if (!b)
{
- write_stderr(_("%s: could not create restricted token: %lu\n"), progname, GetLastError());
+ write_stderr(_("%s: could not create restricted token: error code %lu\n"), progname, GetLastError());
return 0;
}
index 21a951c424de1c445f4ae4830e0723ea10bfee25..a795e24be3f96d2991f8f07fbcd8bb0081389512 100644 (file)
if (!GetTokenInformation(hToken, tic, (LPVOID) ptdd, dwSize, &dwSize))
{
- log_error("could not get token information: %lu", GetLastError());
+ log_error("could not get token information: error code %lu", GetLastError());
goto cleanup;
}
}
else
{
- log_error("could not get token information buffer size: %lu", GetLastError());
+ log_error("could not get token information buffer size: error code %lu", GetLastError());
goto cleanup;
}
}
(DWORD) sizeof(ACL_SIZE_INFORMATION),
AclSizeInformation))
{
- log_error("could not get ACL information: %lu", GetLastError());
+ log_error("could not get ACL information: error code %lu", GetLastError());
goto cleanup;
}
*/
if (!GetTokenUser(hToken, &pTokenUser))
{
- log_error("could not get user token: %lu", GetLastError());
+ log_error("could not get user token: error code %lu", GetLastError());
goto cleanup;
}
if (!InitializeAcl(pacl, dwNewAclSize, ACL_REVISION))
{
- log_error("could not initialize ACL: %lu", GetLastError());
+ log_error("could not initialize ACL: error code %lu", GetLastError());
goto cleanup;
}
{
if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) &pace))
{
- log_error("could not get ACE: %lu", GetLastError());
+ log_error("could not get ACE: error code %lu", GetLastError());
goto cleanup;
}
if (!AddAce(pacl, ACL_REVISION, MAXDWORD, pace, ((PACE_HEADER) pace)->AceSize))
{
- log_error("could not add ACE: %lu", GetLastError());
+ log_error("could not add ACE: error code %lu", GetLastError());
goto cleanup;
}
}
/* Add the new ACE for the current user */
if (!AddAccessAllowedAceEx(pacl, ACL_REVISION, OBJECT_INHERIT_ACE, GENERIC_ALL, pTokenUser->User.Sid))
{
- log_error("could not add access allowed ACE: %lu", GetLastError());
+ log_error("could not add access allowed ACE: error code %lu", GetLastError());
goto cleanup;
}
if (!SetTokenInformation(hToken, tic, (LPVOID) &tddNew, dwNewAclSize))
{
- log_error("could not set token information: %lu", GetLastError());
+ log_error("could not set token information: error code %lu", GetLastError());
goto cleanup;
}
@@ -774,7 +774,7 @@ GetTokenUser(HANDLE hToken, PTOKEN_USER *ppTokenUser)
}
else
{
- log_error("could not get token information buffer size: %lu", GetLastError());
+ log_error("could not get token information buffer size: error code %lu", GetLastError());
return FALSE;
}
}
@@ -788,7 +788,7 @@ GetTokenUser(HANDLE hToken, PTOKEN_USER *ppTokenUser)
LocalFree(*ppTokenUser);
*ppTokenUser = NULL;
- log_error("could not get token information: %lu", GetLastError());
+ log_error("could not get token information: error code %lu", GetLastError());
return FALSE;
}
index 1c5c176e1f25fd14ebf51879bb8bb7499f300571..0b039959d9f902cba692ca9ee970db911f9fd352 100644 (file)
/* Open the current token to use as base for the restricted one */
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &origToken))
{
- fprintf(stderr, _("could not open process token: %lu\n"),
+ fprintf(stderr, _("could not open process token: error code %lu\n"),
GetLastError());
exit_nicely(2);
}
!AllocateAndInitializeSid(&NtAuthority, 2,
SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, 0, &dropSids[1].Sid))
{
- fprintf(stderr, _("could not allocate SIDs: %lu\n"), GetLastError());
+ fprintf(stderr, _("could not allocate SIDs: error code %lu\n"), GetLastError());
exit_nicely(2);
}
if (!b)
{
- fprintf(stderr, _("could not create restricted token: %lu\n"),
+ fprintf(stderr, _("could not create restricted token: error code %lu\n"),
GetLastError());
exit_nicely(2);
}
&si,
&pi))
{
- fprintf(stderr, _("could not start process for \"%s\": %lu\n"),
+ fprintf(stderr, _("could not start process for \"%s\": error code %lu\n"),
cmdline2, GetLastError());
exit_nicely(2);
}
@@ -1380,7 +1380,7 @@ wait_for_tests(PID_TYPE * pids, int *statuses, char **names, int num_tests)
r = WaitForMultipleObjects(tests_left, active_pids, FALSE, INFINITE);
if (r < WAIT_OBJECT_0 || r >= WAIT_OBJECT_0 + tests_left)
{
- fprintf(stderr, _("failed to wait for subprocesses: %lu\n"),
+ fprintf(stderr, _("failed to wait for subprocesses: error code %lu\n"),
GetLastError());
exit_nicely(2);
}
@@ -2295,7 +2295,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
progname, strerror(errno));
#else
if (TerminateProcess(postmaster_pid, 255) == 0)
- fprintf(stderr, _("\n%s: could not kill failed postmaster: %lu\n"),
+ fprintf(stderr, _("\n%s: could not kill failed postmaster: error code %lu\n"),
progname, GetLastError());
#endif
index dfd7ee1ebb4bf5f030d1ea557c8cc7e6e87b7c67..254ddb8ad630dd461bc008cb96ed65bd96c90e5d 100644 (file)
&rootKey) != ERROR_SUCCESS)
{
ereport(LOG,
- (errmsg("could not open registry key to identify system time zone: %d",
- (int) GetLastError()),
+ (errmsg("could not open registry key to identify system time zone: error code %lu",
+ GetLastError()),
errdetail("The PostgreSQL time zone will be set to \"%s\".",
"GMT"),
errhint("You can specify the correct timezone in postgresql.conf.")));