diff --git a/src/main/main.c b/src/main/main.c index 9b55f3d..0856758 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -278,12 +278,11 @@ main(int argc, char **argv) { if (kill(pid, 0) == 0) { - ereport(FATAL, - (errmsg("pid file found. is another pgpool(%d) is running?\n", pid))); + fprintf(stderr, "ERROR: pid file found. is another pgpool(%d) is running?\n", pid); + exit(EXIT_FAILURE); } else - ereport(NOTICE, - (errmsg("pid file found but it seems bogus. Trying to start pgpool anyway...\n"))); + fprintf(stderr, "NOTICE: pid file found but it seems bogus. Trying to start pgpool anyway...\n"); } } diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 8bfcfbc..12eff29 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -960,6 +960,9 @@ create_unix_domain_socket(struct sockaddr_un un_addr_tmp) int status; int len; + /* Delete any pre-existing socket file to avoid failure at bind() time */ + unlink(un_addr_tmp.sun_path); + fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) {