Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3dc3f403
Commit
3dc3f403
authored
Sep 04, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PeekNamedPipe: Check if the pipe was closed when there are 0 available
bytes (based on a patch by Uwe Bonnes).
parent
4d88b6ec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
sync.c
dlls/kernel/sync.c
+25
-3
No files found.
dlls/kernel/sync.c
View file @
3dc3f403
...
...
@@ -29,6 +29,9 @@
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
#include "winbase.h"
#include "winerror.h"
...
...
@@ -543,15 +546,34 @@ BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer,
int
avail
=
0
,
fd
;
fd
=
FILE_GetUnixHandle
(
hPipe
,
GENERIC_READ
);
if
(
fd
==
-
1
)
return
FALSE
;
/* On linux fstat on pipes doesn't work */
if
(
fd
==
-
1
)
return
FALSE
;
if
(
ioctl
(
fd
,
FIONREAD
,
&
avail
)
!=
0
)
{
TRACE
(
"FIONREAD failed reason: %s
\n
"
,
strerror
(
errno
));
close
(
fd
);
return
FALSE
;
}
if
(
!
avail
)
/* check for closed pipe */
{
struct
pollfd
pollfd
;
pollfd
.
fd
=
fd
;
pollfd
.
events
=
POLLIN
;
pollfd
.
revents
=
0
;
switch
(
poll
(
&
pollfd
,
1
,
0
))
{
case
0
:
break
;
case
1
:
/* got something */
if
(
!
(
pollfd
.
revents
&
(
POLLHUP
|
POLLERR
)))
break
;
TRACE
(
"POLLHUP | POLLERR
\n
"
);
/* fall through */
case
-
1
:
close
(
fd
);
SetLastError
(
ERROR_BROKEN_PIPE
);
return
FALSE
;
}
}
close
(
fd
);
TRACE
(
" 0x%08x bytes available
\n
"
,
avail
);
if
(
!
lpvBuffer
&&
lpcbAvail
)
...
...
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