summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-21 02:06:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-21 02:06:06 (GMT)
commitccff6a05bc436fa3c91e39d064a064334ed0a2da (patch)
treed17c06a0f63568bd488d0a3b5a076d6d10d501dd
parent281bebaf4271fd5969dbf2598354dc0387d5d6dd (diff)
parent15a97557ec97ac7918d022a5d3e1ce620f295d83 (diff)
downloadgit-ccff6a05bc436fa3c91e39d064a064334ed0a2da.zip
git-ccff6a05bc436fa3c91e39d064a064334ed0a2da.tar.gz
git-ccff6a05bc436fa3c91e39d064a064334ed0a2da.tar.bz2
Merge branch 'am/mingw-poll-fix' into pu
MinGW's poll() emulation has been improved. * am/mingw-poll-fix: mingw: workaround for hangs when sending STDIN
-rw-r--r--compat/poll/poll.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index 0e95dd4..afa6d24 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -139,22 +139,10 @@ win32_compute_revents (HANDLE h, int *p_sought)
INPUT_RECORD *irbuffer;
DWORD avail, nbuffer;
BOOL bRet;
- IO_STATUS_BLOCK iosb;
- FILE_PIPE_LOCAL_INFORMATION fpli;
- static PNtQueryInformationFile NtQueryInformationFile;
- static BOOL once_only;
switch (GetFileType (h))
{
case FILE_TYPE_PIPE:
- if (!once_only)
- {
- NtQueryInformationFile = (PNtQueryInformationFile)(void (*)(void))
- GetProcAddress (GetModuleHandleW (L"ntdll.dll"),
- "NtQueryInformationFile");
- once_only = TRUE;
- }
-
happened = 0;
if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0)
{
@@ -166,22 +154,9 @@ win32_compute_revents (HANDLE h, int *p_sought)
else
{
- /* It was the write-end of the pipe. Check if it is writable.
- If NtQueryInformationFile fails, optimistically assume the pipe is
- writable. This could happen on Win9x, where 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. */
- memset (&iosb, 0, sizeof (iosb));
- memset (&fpli, 0, sizeof (fpli));
-
- if (!NtQueryInformationFile
- || NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli),
- FilePipeLocalInformation)
- || fpli.WriteQuotaAvailable >= PIPE_BUF
- || (fpli.OutboundQuota < PIPE_BUF &&
- fpli.WriteQuotaAvailable == fpli.OutboundQuota))
+ /* It was the write-end of the pipe. Unfortunately there is no
+ reliable way of knowing if it can be written without blocking.
+ Just say that it's all good. */
happened |= *p_sought & (POLLOUT | POLLWRNORM | POLLWRBAND);
}
return happened;