diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-05-21 21:19:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-05-21 21:19:53 +0000 |
commit | 1f0aff03c025b7e69718a4393fce19e9685cdacd (patch) | |
tree | e706d5663635cdae5c4153c3e1117d09a2cc9896 /src/interfaces/libpq/fe-connect.c | |
parent | 9dab9ab5e488e921ba6f948fa760566cd61e45a9 (diff) | |
download | postgresql-1f0aff03c025b7e69718a4393fce19e9685cdacd.tar.gz postgresql-1f0aff03c025b7e69718a4393fce19e9685cdacd.zip |
Remove calls to getprotobyname(), which we now know leaks memory on
some platforms --- and I also see that it is documented as not thread-
safe on HPUX and possibly other platforms. No good reason not to just
use IPPROTO_TCP constant from <netinet/in.h> instead.
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index c400a7ebb16..400bab2f7d5 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.126 2000/04/12 17:17:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127 2000/05/21 21:19:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ #include <sys/socket.h> #include <unistd.h> #include <netdb.h> +#include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #endif @@ -625,19 +626,9 @@ connectMakeNonblocking(PGconn *conn) static int connectNoDelay(PGconn *conn) { - struct protoent *pe; int on = 1; - pe = getprotobyname("TCP"); - if (pe == NULL) - { - printfPQExpBuffer(&conn->errorMessage, - "connectNoDelay() -- " - "getprotobyname failed: errno=%d\n%s\n", - errno, strerror(errno)); - return 0; - } - if (setsockopt(conn->sock, pe->p_proto, TCP_NODELAY, + if (setsockopt(conn->sock, IPPROTO_TCP, TCP_NODELAY, #ifdef WIN32 (char *) #endif |