Skip to content

Commit d06a8d0

Browse files
committed
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.
1 parent c63147d commit d06a8d0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/backend/port/win32_shmem.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.4 2008/01/01 19:45:51 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.5 2008/07/04 10:50:18 mha Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -47,18 +47,17 @@ GetSharedMemName(void)
4747
elog(FATAL, "could not get size for full pathname of datadir %s: %lu",
4848
DataDir, GetLastError());
4949

50-
retptr = malloc(bufsize + 1 + 18); /* 1 NULL and 18 for
51-
* Global\PostgreSQL: */
50+
retptr = malloc(bufsize + 18); /* 18 for Global\PostgreSQL: */
5251
if (retptr == NULL)
5352
elog(FATAL, "could not allocate memory for shared memory name");
5453

5554
strcpy(retptr, "Global\\PostgreSQL:");
56-
r = GetFullPathName(DataDir, bufsize, retptr + 11, NULL);
55+
r = GetFullPathName(DataDir, bufsize, retptr + 18, NULL);
5756
if (r == 0 || r > bufsize)
5857
elog(FATAL, "could not generate full pathname for datadir %s: %lu",
5958
DataDir, GetLastError());
6059

61-
for (cp = retptr; *cp; cp++)
60+
for (cp = retptr + 18; *cp; cp++)
6261
if (*cp == '\\')
6362
*cp = '/';
6463

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy