Commit bada44a2 authored by Bruce Momjian's avatar Bruce Momjian

Fix code to properly pull out shared memory key now that the

postmaster.pid file is larger than in previous major versions.
This is a bug introduced when I added lines to the file recently.
parent c0577c92
......@@ -825,16 +825,22 @@ CreateLockFile(const char *filename, bool amPostmaster,
*/
if (isDDLock)
{
char *ptr;
char *ptr = NULL;
unsigned long id1,
id2;
int lineno;
ptr = strchr(buffer, '\n');
if (ptr != NULL &&
(ptr = strchr(ptr + 1, '\n')) != NULL)
for (lineno = 1; lineno <= 4; lineno++)
{
if ((ptr = strchr(ptr, '\n')) == NULL)
{
elog(LOG, "bogus data in \"%s\"", DIRECTORY_LOCK_FILE);
break;
}
ptr++;
if (sscanf(ptr, "%lu %lu", &id1, &id2) == 2)
}
if (ptr && sscanf(ptr, "%lu %lu", &id1, &id2) == 2)
{
if (PGSharedMemoryIsInUse(id1, id2))
ereport(FATAL,
......@@ -849,7 +855,6 @@ CreateLockFile(const char *filename, bool amPostmaster,
filename)));
}
}
}
/*
* Looks like nobody's home. Unlink the file and try again to create
......
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