[Wine-patches] [eterhack] [eter-1.0.12] Close a file descriptor used for locks when we need to ignore locks (eterbug #7350).

Alexander Morozov amorozov на etersoft.ru
Вт Июн 7 16:58:17 MSD 2011


----------- следующая часть -----------
From 73fbc26086a60e2bd2d99335bcf2f3da125dea51 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 7 Jun 2011 16:38:15 +0400
Subject: [PATCH] Close a file descriptor used for locks when we need to
 ignore locks (eterbug #7350).

---
 dlls/ntdll/loader.c |    4 ++++
 server/fd.c         |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index e0551d6..30cec8d 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1918,6 +1918,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
     WINE_MODREF *main_exe;
     HANDLE handle = 0;
     NTSTATUS nts;
+    int fd;
 
     TRACE( "looking for %s in %s\n", debugstr_w(libname), debugstr_w(load_path) );
 
@@ -1942,6 +1943,9 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
             wine_server_call( req );
         }
         SERVER_END_REQ;
+
+        fd = server_remove_fd_from_cache( handle );
+        if (fd != -1) close( fd );
     }
 
     if (*pwm)  /* found already loaded module */
diff --git a/server/fd.c b/server/fd.c
index deb0b02..5711620 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2325,10 +2325,20 @@ DECL_HANDLER(add_fd_completion)
 DECL_HANDLER(ignore_locks)
 {
     struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 );
+    int lock_fd;
 
     if (fd)
     {
         fd->fs_locks = 0;
+        if (fd->inode)
+        {
+            lock_fd = inode_get_lock_fd( fd->inode );
+            if (lock_fd != -1)
+            {
+                inode_set_lock_fd( fd->inode, -1 );
+                close( lock_fd );
+            }
+        }
         release_object( fd );
     }
 }
-- 
1.7.4.5



Подробная информация о списке рассылки Wine-patches