From: Magnus Hagander Date: Fri, 4 Jul 2008 10:50:20 +0000 (+0000) Subject: Fix a couple of bugs in win32 shmem name generation: X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=15a6eaf778b63388589352af43074c07650345cc;p=users%2Fbernd%2Fpostgres.git 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. --- diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 6882ad7a8d..970b552043 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -47,18 +47,17 @@ GetSharedMemName(void) elog(FATAL, "could not get size for full pathname of datadir %s: %lu", DataDir, GetLastError()); - retptr = malloc(bufsize + 1 + 18); /* 1 NULL and 18 for - * Global\PostgreSQL: */ + retptr = malloc(bufsize + 18); /* 18 for Global\PostgreSQL: */ if (retptr == NULL) elog(FATAL, "could not allocate memory for shared memory name"); strcpy(retptr, "Global\\PostgreSQL:"); - r = GetFullPathName(DataDir, bufsize, retptr + 11, NULL); + r = GetFullPathName(DataDir, bufsize, retptr + 18, NULL); if (r == 0 || r > bufsize) elog(FATAL, "could not generate full pathname for datadir %s: %lu", DataDir, GetLastError()); - for (cp = retptr; *cp; cp++) + for (cp = retptr + 18; *cp; cp++) if (*cp == '\\') *cp = '/';