Skip to content

Commit 474de35

Browse files
committed
FIx for unix domain sockets, from Goran Thyni.
1 parent 21261b0 commit 474de35

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/backend/libpq/pqcomm.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.27 1997/11/17 16:17:14 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.28 1997/11/19 17:52:00 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -607,8 +607,6 @@ StreamServerPort(char *hostName, short portName, int *fdP)
607607
pqdebug("%s", PQerrormsg);
608608
return (STATUS_ERROR);
609609
}
610-
if (family == AF_UNIX)
611-
on_exitpg(do_unlink, (caddr_t) 0);
612610
if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
613611
sizeof(one))) == -1)
614612
{
@@ -636,14 +634,17 @@ StreamServerPort(char *hostName, short portName, int *fdP)
636634
err = bind(fd, (struct sockaddr *) & saddr, len);
637635
if (err < 0)
638636
{
639-
sprintf(PQerrormsg,
640-
"FATAL: StreamServerPort: bind() failed: errno=%d\n",
641-
errno);
642-
pqdebug("%s", PQerrormsg);
643-
strcat(PQerrormsg, "\tIs another postmaster already running on that port?\n");
644-
strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
645-
fputs(PQerrormsg, stderr);
646-
return (STATUS_ERROR);
637+
sprintf(PQerrormsg,
638+
"FATAL: StreamServerPort: bind() failed: errno=%d\n",
639+
errno);
640+
pqdebug("%s", PQerrormsg);
641+
strcat(PQerrormsg, "\tIs another postmaster already running on that port?\n");
642+
if (family == AF_UNIX)
643+
strcat(PQerrormsg, "\tIf not, remove socket node (/tmp/.s.PGSQL.<portnr>)and retry.\n");
644+
else
645+
strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
646+
fputs(PQerrormsg, stderr);
647+
return (STATUS_ERROR);
647648
}
648649

649650
listen(fd, SOMAXCONN);
@@ -657,6 +658,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
657658
*/
658659

659660
*fdP = fd;
661+
if (family == AF_UNIX) atexit(do_unlink);
660662
return (STATUS_OK);
661663
}
662664

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