Skip to content

Commit 98e195d

Browse files
committed
Make socket option specify just the directory, not the full path.
1 parent 9bc6fb3 commit 98e195d

16 files changed

+42
-46
lines changed

doc/src/sgml/libpq++.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.18 2000/11/13 15:18:07 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.19 2000/11/22 01:41:12 momjian Exp $
33
-->
44

55
<chapter id="libpqplusplus">
@@ -80,8 +80,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.18 2000/11/13 15:18:
8080
<listitem>
8181
<para>
8282
<envar>PGHOST</envar> sets the default server name.
83-
If a non-zero-length string is specified, TCP/IP communication is used.
84-
Without a host name, libpq will connect using a local Unix domain socket.
83+
If it begins with a slash, it is used
84+
as the directory for the unix domain socket.
8585
</para>
8686
</listitem>
8787
<listitem>
@@ -93,8 +93,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.18 2000/11/13 15:18:
9393
</listitem>
9494
<listitem>
9595
<para>
96-
<envar>PGUNIXSOCKET</envar> sets the full Unix domain socket
97-
file name for communicating with the <productname>Postgres</productname>
96+
<envar>PGUNIXSOCKET</envar> sets the Unix domain socket
97+
directory for communicating with the <productname>Postgres</productname>
9898
backend.
9999
</para>
100100
</listitem>

doc/src/sgml/libpq.sgml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.47 2000/11/14 01:53:37 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.48 2000/11/22 01:41:12 momjian Exp $
33
-->
44

55
<chapter id="libpq-chapter">
@@ -90,7 +90,7 @@ PGconn *PQconnectdb(const char *conninfo)
9090
Name of host to connect to.
9191
Using this parameter causes a hostname look-up. See hostaddr.
9292
If it begins with a slash, it is used
93-
as the path to a unix domain socket.
93+
as the directory for the unix domain socket.
9494
</para>
9595
</listitem>
9696
</varlistentry>
@@ -138,7 +138,7 @@ PGconn *PQconnectdb(const char *conninfo)
138138
<term><literal>unixsocket</literal></term>
139139
<listitem>
140140
<para>
141-
Full path to Unix-domain socket file to connect to at the server host.
141+
Directory for Unix-domain socket file.
142142
</para>
143143
</listitem>
144144
</varlistentry>
@@ -567,7 +567,7 @@ char *PQport(const PGconn *conn)
567567
<listitem>
568568
<para>
569569
<function>PQunixsocket</function>
570-
Returns the name of the Unix-domain socket of the connection.
570+
Returns the directory of the Unix-domain socket of the connection.
571571
<synopsis>
572572
char *PQunixsocket(const PGconn *conn)
573573
</synopsis>
@@ -1839,9 +1839,8 @@ application programs.
18391839
<listitem>
18401840
<para>
18411841
<envar>PGHOST</envar> sets the default server name.
1842-
If it beings with a slash, it is used as the path to a unix domain
1842+
If it beings with a slash, it is used as the directory for the unix domain
18431843
socket.
1844-
Without a host name, libpq will connect using a local Unix domain socket.
18451844
</para>
18461845
</listitem>
18471846
<listitem>

doc/src/sgml/ref/createdb.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.14 2000/11/13 23:57:19 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createdb.sgml,v 1.15 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -41,7 +41,7 @@ Postgres documentation
4141
Specifies the hostname of the machine on which the
4242
<application>postmaster</application>
4343
is running. If host begins with a slash, it is used
44-
as the path to a unix domain socket.
44+
as the directory for the unix domain socket.
4545
</para>
4646
</listitem>
4747
</varlistentry>

doc/src/sgml/ref/createlang.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.13 2000/11/13 23:57:19 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createlang.sgml,v 1.14 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -86,7 +86,7 @@ Postgres documentation
8686
Specifies the hostname of the machine on which the
8787
<application>postmaster</application>
8888
is running. If host begins with a slash, it is used
89-
as the path to a unix domain socket.
89+
as the directory for the unix domain socket.
9090
</para>
9191
</listitem>
9292
</varlistentry>

doc/src/sgml/ref/createuser.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.13 2000/11/13 23:57:19 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.14 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -40,7 +40,7 @@ Postgres documentation
4040
Specifies the hostname of the machine on which the
4141
<application>postmaster</application>
4242
is running. If host begins with a slash, it is used
43-
as the path to a unix domain socket.
43+
as the directory for the unix domain socket.
4444
</para>
4545
</listitem>
4646
</varlistentry>

doc/src/sgml/ref/dropdb.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.7 2000/11/13 23:57:19 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.8 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -40,7 +40,7 @@ Postgres documentation
4040
Specifies the hostname of the machine on which the
4141
<application>postmaster</application>
4242
is running. If host begins with a slash, it is used
43-
as the path to a unix domain socket.
43+
as the directory for the unix domain socket.
4444
</para>
4545
</listitem>
4646
</varlistentry>

doc/src/sgml/ref/droplang.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.7 2000/11/13 23:57:19 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/droplang.sgml,v 1.8 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -86,7 +86,7 @@ Postgres documentation
8686
Specifies the hostname of the machine on which the
8787
<application>postmaster</application>
8888
is running. If host begins with a slash, it is used
89-
as the path to a unix domain socket.
89+
as the directory for the unix domain socket.
9090
</para>
9191
</listitem>
9292
</varlistentry>

doc/src/sgml/ref/dropuser.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.8 2000/11/13 23:57:20 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.9 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -40,7 +40,7 @@ Postgres documentation
4040
Specifies the hostname of the machine on which the
4141
<application>postmaster</application>
4242
is running. If host begins with a slash, it is used
43-
as the path to a unix domain socket.
43+
as the directory for the unix domain socket.
4444
</para>
4545
</listitem>
4646
</varlistentry>

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.24 2000/11/21 15:39:09 pjw Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.25 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -323,7 +323,7 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ]
323323
Specifies the hostname of the machine on which the
324324
<application>postmaster</application>
325325
is running. If host begins with a slash, it is used
326-
as the path to a unix domain socket.
326+
as the directory for the unix domain socket.
327327
</para>
328328
</listitem>
329329
</varlistentry>

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.14 2000/11/13 23:57:20 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.15 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -144,7 +144,7 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
144144
Specifies the hostname of the machine on which the
145145
<application>postmaster</application>
146146
is running. If host begins with a slash, it is used
147-
as the path to a unix domain socket.
147+
as the directory for the unix domain socket.
148148
</para>
149149
</listitem>
150150
</varlistentry>

doc/src/sgml/ref/pg_restore.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ pg_restore [ <replaceable class="parameter">archive-file</replaceable> ]
308308
Specifies the hostname of the machine on which the
309309
<application>postmaster</application>
310310
is running. If host begins with a slash, it is used
311-
as the path to a unix domain socket.
311+
as the directory for the unix domain socket.
312312
</para>
313313
</listitem>
314314
</varlistentry>

doc/src/sgml/ref/postmaster.sgml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.15 2000/11/14 18:11:31 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.16 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -188,13 +188,12 @@ Postgres documentation
188188
<term>-k <replaceable class="parameter">filename</replaceable></term>
189189
<listitem>
190190
<para>
191-
Specifies the Unix domain socket file name on which the
191+
Specifies the directory for Unix domain socket on which the
192192
<application>postmaster</application> is to listen for
193193
connections from client applications. Defaults to the value
194194
of the <envar>PGUNIXSOCKET</envar> environment variable, or if
195195
<envar>PGUNIXSOCKET</envar> is not set, then defaults to a
196-
file in <filename>/tmp</filename> constructed from the port
197-
number.
196+
file in <filename>/tmp</filename>.
198197
</para>
199198
</listitem>
200199
</varlistentry>

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.43 2000/11/13 23:57:20 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.44 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -1323,7 +1323,7 @@ Access permissions for database "test"
13231323
Specifies the host name of the machine on which the
13241324
<application>postmaster</application> is running.
13251325
If host begins with a slash, it is used
1326-
as the path to a unix domain socket.
1326+
as the directory for the unix domain socket.
13271327
</para>
13281328
</listitem>
13291329
</varlistentry>

doc/src/sgml/ref/vacuumdb.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.13 2000/11/13 23:57:20 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.14 2000/11/22 01:41:13 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -120,7 +120,7 @@ Postgres documentation
120120
Specifies the hostname of the machine on which the
121121
<application>postmaster</application>
122122
is running. If host begins with a slash, it is used
123-
as the path to a unix domain socket.
123+
as the directory for the unix domain socket.
124124
</para>
125125
</listitem>
126126
</varlistentry>

doc/src/sgml/runtime.sgml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.37 2000/11/15 18:36:03 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.38 2000/11/22 01:41:12 momjian Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -1063,13 +1063,12 @@ env PGOPTIONS='-c geqo=off' psql
10631063
<term>UNIXSOCKET (<type>string</type>)</term>
10641064
<listitem>
10651065
<para>
1066-
Specifies the Unix domain socket file name on which the
1066+
Specifies the directory of the Unix domain socket on which the
10671067
<application>postmaster</application> is to listen for
10681068
connections from client applications. Defaults to the value
10691069
of the <envar>PGUNIXSOCKET</envar> environment variable, or if
1070-
<envar>PGUNIXSOCKET</envar> is not set, then defaults to a
1071-
file in <filename>/tmp</filename> constructed from the port
1072-
number.
1070+
<envar>PGUNIXSOCKET</envar> is not set, then defaults to
1071+
<filename>/tmp</filename>.
10731072
</para>
10741073
</listitem>
10751074
</varlistentry>

src/include/libpq/pqcomm.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Id: pqcomm.h,v 1.45 2000/11/15 18:36:06 petere Exp $
12+
* $Id: pqcomm.h,v 1.46 2000/11/22 01:41:14 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -51,17 +51,16 @@ typedef union SockAddr
5151
/* Configure the UNIX socket address for the well known port. */
5252

5353
#if defined(SUN_LEN)
54-
#define UNIXSOCK_PATH(sun,port,defpath) \
55-
((defpath && defpath[0] != '\0') ? (strncpy((sun).sun_path, defpath, sizeof((sun).sun_path)), (sun).sun_path[sizeof((sun).sun_path)-1] = '\0') : sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)))
5654
#define UNIXSOCK_LEN(sun) \
5755
(SUN_LEN(&(sun)))
5856
#else
59-
#define UNIXSOCK_PATH(sun,port,defpath) \
60-
((defpath && defpath[0] != '\0') ? (strncpy((sun).sun_path, defpath, sizeof((sun).sun_path)), (sun).sun_path[sizeof((sun).sun_path)-1] = '\0') : sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)))
6157
#define UNIXSOCK_LEN(sun) \
6258
(strlen((sun).sun_path)+ offsetof(struct sockaddr_un, sun_path))
6359
#endif
6460

61+
#define UNIXSOCK_PATH(sun,port,defpath) \
62+
(snprintf((sun).sun_path, UNIXSOCK_LEN(sun), "%s/.s.PGSQL.%d", (defpath && *(defpath) != '\0') ? (defpath) : "/tmp", (port)))
63+
6564
/*
6665
* We do this because sun_len is in BSD's struct, while others don't.
6766
* We never actually set BSD's sun_len, and I can't think of a

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