Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac608fe

Browse files
committed
Use type pgsocket for Windows pipe emulation socket calls
This prevents several compiler warnings on Windows.
1 parentbe76a6d commitac608fe

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

‎src/bin/pg_dump/parallel.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,18 +1320,23 @@ readMessageFromPipe(int fd)
13201320
/*
13211321
* This is a replacement version of pipe for Win32 which allows returned
13221322
* handles to be used in select(). Note that read/write calls must be replaced
1323-
* with recv/send.
1323+
* with recv/send. "handles" have to be integers so we check for errors then
1324+
* cast to integers.
13241325
*/
13251326
staticint
13261327
pgpipe(inthandles[2])
13271328
{
1328-
SOCKETs;
1329+
pgsockets,tmp_sock;
13291330
structsockaddr_inserv_addr;
13301331
intlen=sizeof(serv_addr);
13311332

1332-
handles[0]=handles[1]=INVALID_SOCKET;
1333+
/* We have to use the Unix socket invalid file descriptor value here. */
1334+
handles[0]=handles[1]=-1;
13331335

1334-
if ((s=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET)
1336+
/*
1337+
* setup listen socket
1338+
*/
1339+
if ((s=socket(AF_INET,SOCK_STREAM,0))==PGINVALID_SOCKET)
13351340
{
13361341
write_msg(modulename,"pgpipe: could not create socket: error code %d\n",
13371342
WSAGetLastError());
@@ -1363,13 +1368,18 @@ pgpipe(int handles[2])
13631368
closesocket(s);
13641369
return-1;
13651370
}
1366-
if ((handles[1]=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET)
1371+
1372+
/*
1373+
* setup pipe handles
1374+
*/
1375+
if ((tmp_sock=socket(AF_INET,SOCK_STREAM,0))==PGINVALID_SOCKET)
13671376
{
13681377
write_msg(modulename,"pgpipe: could not create second socket: error code %d\n",
13691378
WSAGetLastError());
13701379
closesocket(s);
13711380
return-1;
13721381
}
1382+
handles[1]= (int)tmp_sock;
13731383

13741384
if (connect(handles[1], (SOCKADDR*)&serv_addr,len)==SOCKET_ERROR)
13751385
{
@@ -1378,15 +1388,17 @@ pgpipe(int handles[2])
13781388
closesocket(s);
13791389
return-1;
13801390
}
1381-
if ((handles[0]=accept(s, (SOCKADDR*)&serv_addr,&len))==INVALID_SOCKET)
1391+
if ((tmp_sock=accept(s, (SOCKADDR*)&serv_addr,&len))==PGINVALID_SOCKET)
13821392
{
13831393
write_msg(modulename,"pgpipe: could not accept connection: error code %d\n",
13841394
WSAGetLastError());
13851395
closesocket(handles[1]);
1386-
handles[1]=INVALID_SOCKET;
1396+
handles[1]=-1;
13871397
closesocket(s);
13881398
return-1;
13891399
}
1400+
handles[0]= (int)tmp_sock;
1401+
13901402
closesocket(s);
13911403
return0;
13921404
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp