At pgpool startup, if pid file exists, truncate pid file to zero length before writing.
authorBo Peng <pengbo@sraoss.co.jp>
Wed, 12 Aug 2020 07:07:04 +0000 (16:07 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Wed, 12 Aug 2020 07:07:04 +0000 (16:07 +0900)
Patch is created by maliangzhu.

src/main/main.c

index c463b0f3ef44a870bf4d33b5c412d9b82342a861..1c83cef7053845acce414f45e57ef65e757fd954 100644 (file)
@@ -656,7 +656,7 @@ write_pid_file(void)
                                                   pool_config->pid_file_name)));
        }
 
-       fd = open(pid_file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
+       fd = open(pid_file, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR);
        if (fd == -1)
        {
                ereport(FATAL,