1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Report postmaster.pid file as empty if it is empty, rather than

reporting in contains invalid data.
This commit is contained in:
Bruce Momjian
2012-08-29 17:05:22 -04:00
parent c82dedb7a8
commit 3825963e7f
2 changed files with 15 additions and 2 deletions

View File

@ -766,6 +766,14 @@ CreateLockFile(const char *filename, bool amPostmaster,
filename)));
close(fd);
if (len == 0)
{
ereport(FATAL,
(errcode(ERRCODE_LOCK_FILE_EXISTS),
errmsg("lock file \"%s\" is empty", filename),
errhint("Either another server is starting, or the lock file is the remnant of a previous server startup crash.")));
}
buffer[len] = '\0';
encoded_pid = atoi(buffer);