Silently handle EINTR and retry operation
This commit is contained in:
parent
bf30d54fac
commit
9039a23de3
@ -333,7 +333,11 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
||||
|
||||
pipe = (WINPR_PIPE*) Object;
|
||||
|
||||
io_status = read(pipe->fd, lpBuffer, nNumberOfBytesToRead);
|
||||
do
|
||||
{
|
||||
io_status = read(pipe->fd, lpBuffer, nNumberOfBytesToRead);
|
||||
}
|
||||
while ((io_status < 0) && (errno == EINTR));
|
||||
|
||||
if (io_status < 0)
|
||||
{
|
||||
@ -364,7 +368,11 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
||||
if (pipe->clientfd == -1)
|
||||
return FALSE;
|
||||
|
||||
io_status = read(pipe->clientfd, lpBuffer, nNumberOfBytesToRead);
|
||||
do
|
||||
{
|
||||
io_status = read(pipe->clientfd, lpBuffer, nNumberOfBytesToRead);
|
||||
}
|
||||
while ((io_status < 0) && (errno == EINTR));
|
||||
|
||||
if (io_status == 0)
|
||||
{
|
||||
@ -478,7 +486,11 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
|
||||
|
||||
pipe = (WINPR_PIPE*) Object;
|
||||
|
||||
io_status = write(pipe->fd, lpBuffer, nNumberOfBytesToWrite);
|
||||
do
|
||||
{
|
||||
io_status = write(pipe->fd, lpBuffer, nNumberOfBytesToWrite);
|
||||
}
|
||||
while ((io_status < 0) && (errno == EINTR));
|
||||
|
||||
if ((io_status < 0) && (errno == EWOULDBLOCK))
|
||||
io_status = 0;
|
||||
@ -501,7 +513,11 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
|
||||
if (pipe->clientfd == -1)
|
||||
return FALSE;
|
||||
|
||||
io_status = write(pipe->clientfd, lpBuffer, nNumberOfBytesToWrite);
|
||||
do
|
||||
{
|
||||
io_status = write(pipe->clientfd, lpBuffer, nNumberOfBytesToWrite);
|
||||
}
|
||||
while ((io_status < 0) && (errno == EINTR));
|
||||
|
||||
if (io_status < 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user