Skip to content

Commit 73d0514

Browse files
committed
Make default socket directory location configurable from config.h.
If we're going to let it be run-time configurable, might as well allow this too...
1 parent 7967547 commit 73d0514

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

src/include/config.h.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.151 2000/11/30 08:46:25 vadim Exp $
11+
* $Id: config.h.in,v 1.152 2000/11/30 23:19:04 tgl Exp $
1212
*/
1313

1414
#ifndef CONFIG_H
@@ -234,6 +234,16 @@
234234
# define HAVE_UNIX_SOCKETS 1
235235
#endif
236236

237+
/*
238+
* This is the default directory in which AF_UNIX socket files are placed.
239+
* Caution: changing this risks breaking your existing client applications,
240+
* which are likely to continue to look in the old directory. But if you
241+
* just hate the idea of sockets in /tmp, here's where to twiddle it.
242+
* You can also override this at runtime with the postmaster's -k switch.
243+
*/
244+
#define DEFAULT_PGSOCKET_DIR "/tmp"
245+
246+
237247
/*
238248
*------------------------------------------------------------------------
239249
* These hand-configurable symbols are for enabling debugging code,

src/include/libpq/pqcomm.h

Lines changed: 13 additions & 11 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.51 2000/11/25 22:34:14 momjian Exp $
12+
* $Id: pqcomm.h,v 1.52 2000/11/30 23:19:04 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -48,24 +48,26 @@ typedef union SockAddr
4848
} SockAddr;
4949

5050

51-
/* Configure the UNIX socket address for the well known port. */
52-
53-
#if defined(SUN_LEN)
54-
#define UNIXSOCK_LEN(sun) \
55-
(SUN_LEN(&(sun)))
56-
#else
57-
#define UNIXSOCK_LEN(sun) \
58-
(strlen((sun).sun_path)+ offsetof(struct sockaddr_un, sun_path))
59-
#endif
51+
/* Configure the UNIX socket location for the well known port. */
6052

6153
#define UNIXSOCK_PATH(sun,port,defpath) \
62-
(sprintf((sun).sun_path, "%s/.s.PGSQL.%d", ((defpath) && *(defpath) != '\0') ? (defpath) : "/tmp", (port)))
54+
sprintf((sun).sun_path, "%s/.s.PGSQL.%d", \
55+
((defpath) && *(defpath) != '\0') ? (defpath) : \
56+
DEFAULT_PGSOCKET_DIR, \
57+
(port))
6358

6459
/*
6560
* We do this because sun_len is in BSD's struct, while others don't.
6661
* We never actually set BSD's sun_len, and I can't think of a
6762
* platform-safe way of doing it, but the code still works. bjm
6863
*/
64+
#if defined(SUN_LEN)
65+
#define UNIXSOCK_LEN(sun) \
66+
(SUN_LEN(&(sun)))
67+
#else
68+
#define UNIXSOCK_LEN(sun) \
69+
(strlen((sun).sun_path) + offsetof(struct sockaddr_un, sun_path))
70+
#endif
6971

7072
/*
7173
* These manipulate the frontend/backend protocol version number.

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