Commit d06a8d05 authored by Magnus Hagander's avatar Magnus Hagander

Fix a couple of bugs in win32 shmem name generation:

* Don't cut off the prefix. With this fix, it's again readable.
* Properly store it in the Global namespace as intended.
parent c63147d6
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.4 2008/01/01 19:45:51 momjian Exp $ * $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.5 2008/07/04 10:50:18 mha Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -47,18 +47,17 @@ GetSharedMemName(void) ...@@ -47,18 +47,17 @@ GetSharedMemName(void)
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: %lu",
DataDir, GetLastError()); DataDir, GetLastError());
retptr = malloc(bufsize + 1 + 18); /* 1 NULL and 18 for retptr = malloc(bufsize + 18); /* 18 for Global\PostgreSQL: */
* Global\PostgreSQL: */
if (retptr == NULL) if (retptr == NULL)
elog(FATAL, "could not allocate memory for shared memory name"); elog(FATAL, "could not allocate memory for shared memory name");
strcpy(retptr, "Global\\PostgreSQL:"); strcpy(retptr, "Global\\PostgreSQL:");
r = GetFullPathName(DataDir, bufsize, retptr + 11, NULL); r = GetFullPathName(DataDir, bufsize, retptr + 18, NULL);
if (r == 0 || r > bufsize) 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: %lu",
DataDir, GetLastError()); DataDir, GetLastError());
for (cp = retptr; *cp; cp++) for (cp = retptr + 18; *cp; cp++)
if (*cp == '\\') if (*cp == '\\')
*cp = '/'; *cp = '/';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment