Skip to content

Commit e921ff1

Browse files
committed
Back out socket path until it works.
1 parent c8b9b14 commit e921ff1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/include/libpq/pqcomm.h

Lines changed: 5 additions & 4 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.47 2000/11/22 02:38:25 momjian Exp $
12+
* $Id: pqcomm.h,v 1.48 2000/11/22 02:47:30 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -51,16 +51,17 @@ 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)))
5456
#define UNIXSOCK_LEN(sun) \
5557
(SUN_LEN(&(sun)))
5658
#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)))
5761
#define UNIXSOCK_LEN(sun) \
5862
(strlen((sun).sun_path)+ offsetof(struct sockaddr_un, sun_path))
5963
#endif
6064

61-
#define UNIXSOCK_PATH(sun,port,defpath) \
62-
(snprintf((sun).sun_path, UNIXSOCK_LEN(sun), "/tmp/.s.PGSQL.%d", (port)))
63-
6465
/*
6566
* We do this because sun_len is in BSD's struct, while others don't.
6667
* 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