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
ac608fe7
Commit
ac608fe7
authored
Jun 16, 2014
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use type pgsocket for Windows pipe emulation socket calls
This prevents several compiler warnings on Windows.
parent
be76a6d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
src/bin/pg_dump/parallel.c
src/bin/pg_dump/parallel.c
+19
-7
No files found.
src/bin/pg_dump/parallel.c
View file @
ac608fe7
...
@@ -1320,18 +1320,23 @@ readMessageFromPipe(int fd)
...
@@ -1320,18 +1320,23 @@ readMessageFromPipe(int fd)
/*
/*
* This is a replacement version of pipe for Win32 which allows returned
* This is a replacement version of pipe for Win32 which allows returned
* handles to be used in select(). Note that read/write calls must be replaced
* handles to be used in select(). Note that read/write calls must be replaced
* with recv/send.
* with recv/send. "handles" have to be integers so we check for errors then
* cast to integers.
*/
*/
static
int
static
int
pgpipe
(
int
handles
[
2
])
pgpipe
(
int
handles
[
2
])
{
{
SOCKET
s
;
pgsocket
s
,
tmp_sock
;
struct
sockaddr_in
serv_addr
;
struct
sockaddr_in
serv_addr
;
int
len
=
sizeof
(
serv_addr
);
int
len
=
sizeof
(
serv_addr
);
handles
[
0
]
=
handles
[
1
]
=
INVALID_SOCKET
;
/* We have to use the Unix socket invalid file descriptor value here. */
handles
[
0
]
=
handles
[
1
]
=
-
1
;
if
((
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
/*
* setup listen socket
*/
if
((
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
PGINVALID_SOCKET
)
{
{
write_msg
(
modulename
,
"pgpipe: could not create socket: error code %d
\n
"
,
write_msg
(
modulename
,
"pgpipe: could not create socket: error code %d
\n
"
,
WSAGetLastError
());
WSAGetLastError
());
...
@@ -1363,13 +1368,18 @@ pgpipe(int handles[2])
...
@@ -1363,13 +1368,18 @@ pgpipe(int handles[2])
closesocket
(
s
);
closesocket
(
s
);
return
-
1
;
return
-
1
;
}
}
if
((
handles
[
1
]
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
/*
* setup pipe handles
*/
if
((
tmp_sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
PGINVALID_SOCKET
)
{
{
write_msg
(
modulename
,
"pgpipe: could not create second socket: error code %d
\n
"
,
write_msg
(
modulename
,
"pgpipe: could not create second socket: error code %d
\n
"
,
WSAGetLastError
());
WSAGetLastError
());
closesocket
(
s
);
closesocket
(
s
);
return
-
1
;
return
-
1
;
}
}
handles
[
1
]
=
(
int
)
tmp_sock
;
if
(
connect
(
handles
[
1
],
(
SOCKADDR
*
)
&
serv_addr
,
len
)
==
SOCKET_ERROR
)
if
(
connect
(
handles
[
1
],
(
SOCKADDR
*
)
&
serv_addr
,
len
)
==
SOCKET_ERROR
)
{
{
...
@@ -1378,15 +1388,17 @@ pgpipe(int handles[2])
...
@@ -1378,15 +1388,17 @@ pgpipe(int handles[2])
closesocket
(
s
);
closesocket
(
s
);
return
-
1
;
return
-
1
;
}
}
if
((
handles
[
0
]
=
accept
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
&
len
))
==
INVALID_SOCKET
)
if
((
tmp_sock
=
accept
(
s
,
(
SOCKADDR
*
)
&
serv_addr
,
&
len
))
==
PG
INVALID_SOCKET
)
{
{
write_msg
(
modulename
,
"pgpipe: could not accept connection: error code %d
\n
"
,
write_msg
(
modulename
,
"pgpipe: could not accept connection: error code %d
\n
"
,
WSAGetLastError
());
WSAGetLastError
());
closesocket
(
handles
[
1
]);
closesocket
(
handles
[
1
]);
handles
[
1
]
=
INVALID_SOCKET
;
handles
[
1
]
=
-
1
;
closesocket
(
s
);
closesocket
(
s
);
return
-
1
;
return
-
1
;
}
}
handles
[
0
]
=
(
int
)
tmp_sock
;
closesocket
(
s
);
closesocket
(
s
);
return
0
;
return
0
;
}
}
...
...
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