- if (!PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL))
- return POLLERR;
-
- if (avail)
- happened |= sought & (POLLIN | POLLRDNORM);
-
- memset (&iosb, 0, sizeof (iosb));
- memset (&fpli, 0, sizeof (fpli));
-
- /* If NtQueryInformationFile fails, optimistically assume the pipe is
- writable. This could happen on Win9x, because NtQueryInformationFile
- is not available, or if we inherit a pipe that doesn't permit
- FILE_READ_ATTRIBUTES access on the write end (I think this should
- not happen since WinXP SP2; WINE seems fine too). Otherwise,
- ensure that enough space is available for atomic writes. */
- if (NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
- FilePipeLocalInformation)
- || fpli.WriteQuotaAvailable >= PIPE_BUF
- || (fpli.OutboundQuota < PIPE_BUF &&
- fpli.WriteQuotaAvailable == fpli.OutboundQuota))
- happened |= sought & (POLLOUT | POLLWRNORM | POLLWRBAND);
+ if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
+ {
+ if (avail)
+ happened |= sought & (POLLIN | POLLRDNORM);
+ }