Close a file descriptor used for locks when we need to ignore locks (eterbug #7350).
authorAlexander Morozov <amorozov@etersoft.ru>
Tue, 7 Jun 2011 12:38:15 +0000 (16:38 +0400)
committerTest Robot <wine-patches-test@office.etersoft.ru>
Tue, 7 Jun 2011 13:30:13 +0000 (17:30 +0400)
dlls/ntdll/loader.c
server/fd.c

index e0551d61fd0f709e18205229894e61ca3abf245b..30cec8d84e4282ca39fbc1bb5fa30191307f9b32 100644 (file)
@@ -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 */
index deb0b024f10a1803f26b58f9a924db3ef2e4255a..571162017cd47fed554918bec623a919205b337c 100644 (file)
@@ -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 );
     }
 }