Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
db7e46a7
Commit
db7e46a7
authored
Apr 25, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use closesocket() for all socket/pipe closing, because Win32 requires
it, and map that to close() on Unix.
parent
5f677af2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
52 deletions
+33
-52
src/backend/libpq/hba.c
src/backend/libpq/hba.c
+2
-2
src/backend/libpq/pqcomm.c
src/backend/libpq/pqcomm.c
+4
-4
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+8
-8
src/include/c.h
src/include/c.h
+8
-1
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+4
-22
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+1
-5
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/fe-misc.c
+1
-5
src/interfaces/python/pgmodule.c
src/interfaces/python/pgmodule.c
+5
-5
No files found.
src/backend/libpq/hba.c
View file @
db7e46a7
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.
99 2003/04/17 22:26:01 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.
100 2003/04/25 01:24:00 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1212,7 +1212,7 @@ ident_inet(const struct in_addr remote_ip_addr,
ident_user
);
}
}
close
(
sock_fd
);
close
socket
(
sock_fd
);
}
}
return
ident_return
;
...
...
src/backend/libpq/pqcomm.c
View file @
db7e46a7
...
...
@@ -30,7 +30,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.15
1 2003/04/22 00:08:06 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.15
2 2003/04/25 01:24:00 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -150,7 +150,7 @@ pq_close(void)
if
(
MyProcPort
!=
NULL
)
{
secure_close
(
MyProcPort
);
close
(
MyProcPort
->
sock
);
close
socket
(
MyProcPort
->
sock
);
/* make sure any subsequent attempts to do I/O fail cleanly */
MyProcPort
->
sock
=
-
1
;
}
...
...
@@ -228,7 +228,7 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
snprintf
(
portNumberStr
,
sizeof
(
portNumberStr
),
"%d"
,
portNumber
);
service
=
portNumberStr
;
}
ret
=
getaddrinfo2
(
hostName
,
service
,
&
hint
,
&
addrs
);
if
(
ret
||
addrs
==
NULL
)
{
...
...
@@ -470,7 +470,7 @@ StreamConnection(int server_fd, Port *port)
void
StreamClose
(
int
sock
)
{
close
(
sock
);
close
socket
(
sock
);
}
/*
...
...
src/backend/postmaster/pgstat.c
View file @
db7e46a7
...
...
@@ -16,7 +16,7 @@
*
* Copyright (c) 2001, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.3
2 2003/03/20 03:34:56
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.3
3 2003/04/25 01:24:00
momjian Exp $
* ----------
*/
#include "postgres.h"
...
...
@@ -235,7 +235,7 @@ pgstat_init(void)
startup_failed:
if
(
pgStatSock
>=
0
)
close
(
pgStatSock
);
close
socket
(
pgStatSock
);
pgStatSock
=
-
1
;
/* Adjust GUC variables to suppress useless activity */
...
...
@@ -359,10 +359,10 @@ void
pgstat_close_sockets
(
void
)
{
if
(
pgStatPmPipe
[
0
]
>=
0
)
close
(
pgStatPmPipe
[
0
]);
close
socket
(
pgStatPmPipe
[
0
]);
pgStatPmPipe
[
0
]
=
-
1
;
if
(
pgStatPmPipe
[
1
]
>=
0
)
close
(
pgStatPmPipe
[
1
]);
close
socket
(
pgStatPmPipe
[
1
]);
pgStatPmPipe
[
1
]
=
-
1
;
}
...
...
@@ -1120,7 +1120,7 @@ pgstat_main(void)
* Close the writing end of the postmaster pipe, so we'll see it
* closing when the postmaster terminates and can terminate as well.
*/
close
(
pgStatPmPipe
[
1
]);
close
socket
(
pgStatPmPipe
[
1
]);
pgStatPmPipe
[
1
]
=
-
1
;
/*
...
...
@@ -1167,13 +1167,13 @@ pgstat_main(void)
case
0
:
/* child becomes collector process */
close
(
pgStatPipe
[
1
]);
close
(
pgStatSock
);
close
socket
(
pgStatPipe
[
1
]);
close
socket
(
pgStatSock
);
break
;
default:
/* parent becomes buffer process */
close
(
pgStatPipe
[
0
]);
close
socket
(
pgStatPipe
[
0
]);
pgstat_recvbuffer
();
exit
(
0
);
}
...
...
src/include/c.h
View file @
db7e46a7
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.1
39 2003/04/22 02:18:09
momjian Exp $
* $Id: c.h,v 1.1
40 2003/04/25 01:24:00
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -721,6 +721,13 @@ int pgunlink(const char *path);
#define unlink(from, to) pgunlink(from, to)
#endif
/*
* Win32 requires a special close for sockets and pipes, while on Unix
* close() does them all.
*/
#ifndef WIN32
#define closesocket close
#endif
/* These are for things that are one way on Unix and another on NT */
#define NULL_DEV "/dev/null"
...
...
src/interfaces/libpq/fe-connect.c
View file @
db7e46a7
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.23
5 2003/04/24 21:16:44 tgl
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.23
6 2003/04/25 01:24:00 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -956,7 +956,7 @@ retry1:
/* ignore connect() failure if we have more addrs to try */
if
(
addr_cur
->
ai_next
!=
NULL
)
{
close
(
conn
->
sock
);
close
socket
(
conn
->
sock
);
conn
->
sock
=
-
1
;
continue
;
}
...
...
@@ -1015,11 +1015,7 @@ retry2:
if
(
conn
->
Pfdebug
)
fprintf
(
conn
->
Pfdebug
,
"Postmaster reports error, attempting fallback to pre-7.0.
\n
"
);
pqsecure_close
(
conn
);
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
conn
->
sock
=
-
1
;
conn
->
allow_ssl_try
=
FALSE
;
return
connectDBStart
(
conn
);
...
...
@@ -1056,11 +1052,7 @@ connect_errReturn:
if
(
conn
->
sock
>=
0
)
{
pqsecure_close
(
conn
);
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
conn
->
sock
=
-
1
;
}
conn
->
status
=
CONNECTION_BAD
;
...
...
@@ -1928,11 +1920,7 @@ freePGconn(PGconn *conn)
if
(
conn
->
sock
>=
0
)
{
pqsecure_close
(
conn
);
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
}
if
(
conn
->
pghost
)
free
(
conn
->
pghost
);
...
...
@@ -2003,11 +1991,7 @@ closePGconn(PGconn *conn)
if
(
conn
->
sock
>=
0
)
{
pqsecure_close
(
conn
);
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
}
conn
->
sock
=
-
1
;
conn
->
status
=
CONNECTION_BAD
;
/* Well, not really _bad_ - just
...
...
@@ -2187,11 +2171,10 @@ retry4:
}
/* Sent it, done */
#ifdef WIN32
closesocket
(
tmpsock
);
#ifdef WIN32
WSASetLastError
(
save_errno
);
#else
close
(
tmpsock
);
errno
=
save_errno
;
#endif
...
...
@@ -2203,11 +2186,10 @@ cancel_errReturn:
conn
->
errorMessage
.
len
=
strlen
(
conn
->
errorMessage
.
data
);
if
(
tmpsock
>=
0
)
{
#ifdef WIN32
closesocket
(
tmpsock
);
#ifdef WIN32
WSASetLastError
(
save_errno
);
#else
close
(
tmpsock
);
errno
=
save_errno
;
#endif
}
...
...
src/interfaces/libpq/fe-exec.c
View file @
db7e46a7
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.13
1 2003/04/24 21:16:44 tgl
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.13
2 2003/04/25 01:24:00 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1161,11 +1161,7 @@ handleSyncLoss(PGconn *conn, char id, int msgLength)
id
,
msgLength
);
conn
->
status
=
CONNECTION_BAD
;
/* No more connection to backend */
pqsecure_close
(
conn
);
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
conn
->
sock
=
-
1
;
}
...
...
src/interfaces/libpq/fe-misc.c
View file @
db7e46a7
...
...
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.9
0 2003/04/22 00:08:07 tgl
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.9
1 2003/04/25 01:24:00 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -681,11 +681,7 @@ definitelyFailed:
"
\t
before or while processing the request.
\n
"
));
conn
->
status
=
CONNECTION_BAD
;
/* No more connection to backend */
pqsecure_close
(
conn
);
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
conn
->
sock
=
-
1
;
return
-
1
;
...
...
src/interfaces/python/pgmodule.c
View file @
db7e46a7
...
...
@@ -2405,10 +2405,10 @@ pg_inserttable(pgobject * self, PyObject * args)
n
=
j
;
/* never used before this assignment */
}
if
(
n
)
{
{
/* allocate buffer */
if
(
!
(
buffer
=
malloc
(
MAX_BUFFER_SIZE
)))
{
{
PyErr_SetString
(
PyExc_MemoryError
,
"can't allocate insert buffer."
);
return
NULL
;
...
...
@@ -2438,7 +2438,7 @@ pg_inserttable(pgobject * self, PyObject * args)
getsubitem
=
PyTuple_GetItem
;
else
getsubitem
=
PyList_GetItem
;
/* builds insert line */
bufpt
=
buffer
;
bufsiz
=
MAX_BUFFER_SIZE
-
1
;
...
...
@@ -2527,7 +2527,7 @@ pg_inserttable(pgobject * self, PyObject * args)
{
*
bufpt
++
=
'\t'
;
--
bufsiz
;
}
if
(
bufsiz
<=
0
)
{
free
(
buffer
);
...
...
@@ -2543,7 +2543,7 @@ pg_inserttable(pgobject * self, PyObject * args)
/* sends data */
PQputline
(
self
->
cnx
,
buffer
);
}
/* ends query */
PQputline
(
self
->
cnx
,
"
\\
.
\n
"
);
PQendcopy
(
self
->
cnx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment