diff options
| author | Magnus Hagander <magnus@hagander.net> | 2010-11-16 12:40:56 +0100 | 
|---|---|---|
| committer | Magnus Hagander <magnus@hagander.net> | 2010-11-16 12:44:19 +0100 | 
| commit | d3f62f232fc874efb22a06b2fd370eefa5f62790 (patch) | |
| tree | d548537b7c75baaaeeea2e3cecb83647304f4a83 | |
| parent | 821bb177227be9287f8fd50c2398c7bc5c3929e3 (diff) | |
Send paramHandle to subprocesses as 64-bit on Win64
The handle to the shared memory segment containing startup
parameters was sent as 32-bit even on 64-bit systems. Since
HANDLEs appear to be allocated sequentially this shouldn't
be a problem until we reach 2^32 open handles in the postmaster,
but a 64-bit value should be sent across as 64-bit, and not
zero out the top 32 bits.
Noted by Tom Lane.
| -rw-r--r-- | src/backend/postmaster/postmaster.c | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 4e8da0e3c42..279f0f081a4 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -3749,7 +3749,11 @@ internal_forkexec(int argc, char *argv[], Port *port)  	}  	/* Insert temp file name after --fork argument */ +#ifdef _WIN64 +	sprintf(paramHandleStr, "%llu", (LONG_PTR) paramHandle); +#else  	sprintf(paramHandleStr, "%lu", (DWORD) paramHandle); +#endif  	argv[2] = paramHandleStr;  	/* Format the cmd line */ @@ -4819,7 +4823,11 @@ read_backend_variables(char *id, Port *port)  	HANDLE		paramHandle;  	BackendParameters *paramp; +#ifdef _WIN64 +	paramHandle = (HANDLE) _atoi64(id); +#else  	paramHandle = (HANDLE) atol(id); +#endif  	paramp = MapViewOfFile(paramHandle, FILE_MAP_READ, 0, 0, 0);  	if (!paramp)  	{ | 
