[PATCH 1/2] msvcrt: Do not acquire fd lock in msvcrt_create_io_inherit_block.

Thomas Faber thomas.faber at reactos.org
Thu Nov 11 19:23:35 CST 2021


From: Doug Lyons <douglyons at douglyons.com>

It's a read-only operation anyway, and trying to acquire the lock
would deadlock if blocking I/O is in progress on any file during
spawn().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51647
Signed-off-by: Doug Lyons <douglyons at douglyons.com>
Signed-off-by: Thomas Faber <thomas.faber at reactos.org>
---
  dlls/msvcrt/file.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index fd7168991f4..e954460ea9a 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -543,7 +543,7 @@ unsigned msvcrt_create_io_inherit_block(WORD *size, BYTE **block)
    for (fd = 0; fd < last_fd; fd++)
    {
      /* to be inherited, we need it to be open, and that DONTINHERIT isn't set */
-    fdinfo = get_ioinfo(fd);
+    fdinfo = get_ioinfo_nolock(fd);
      if ((fdinfo->wxflag & (WX_OPEN | WX_DONTINHERIT)) == WX_OPEN)
      {
        *wxflag_ptr = fdinfo->wxflag;
@@ -554,7 +554,6 @@ unsigned msvcrt_create_io_inherit_block(WORD *size, BYTE **block)
        *wxflag_ptr = 0;
        *handle_ptr = INVALID_HANDLE_VALUE;
      }
-    release_ioinfo(fdinfo);
      wxflag_ptr++; handle_ptr++;
    }
    return TRUE;
-- 
2.31.1



More information about the wine-devel mailing list