Alexandre Julliard : server: Remove failed ioctls from the queue as soon as the result is set.

Alexandre Julliard julliard at winehq.org
Tue Oct 30 08:32:47 CDT 2007


Module: wine
Branch: master
Commit: 8268ad551a258de88f4e0338a19e4866fc0deea0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8268ad551a258de88f4e0338a19e4866fc0deea0

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 30 11:30:58 2007 +0100

server: Remove failed ioctls from the queue as soon as the result is set.

---

 server/device.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/server/device.c b/server/device.c
index 46b2796..d5e5e44 100644
--- a/server/device.c
+++ b/server/device.c
@@ -226,11 +226,20 @@ static void set_ioctl_result( struct ioctl_call *ioctl, unsigned int status,
     ioctl->device = NULL;
     if (ioctl->async)
     {
-        async_terminate( ioctl->async, ioctl->out_size ? STATUS_ALERTED : status );
+        if (ioctl->out_size) status = STATUS_ALERTED;
+        async_terminate( ioctl->async, status );
         release_object( ioctl->async );
         ioctl->async = NULL;
     }
     wake_up( &ioctl->obj, 0 );
+
+    if (status != STATUS_ALERTED)
+    {
+        /* remove it from the device queue */
+        /* (for STATUS_ALERTED this will be done in get_ioctl_result) */
+        list_remove( &ioctl->dev_entry );
+        release_object( ioctl );  /* no longer on the device queue */
+    }
 }
 
 
@@ -352,12 +361,12 @@ static struct device *create_device( struct directory *root, const struct unicod
 
 static void delete_device( struct device *device )
 {
-    struct ioctl_call *ioctl;
+    struct ioctl_call *ioctl, *next;
 
     if (!device->manager) return;  /* already deleted */
 
     /* terminate all pending requests */
-    LIST_FOR_EACH_ENTRY( ioctl, &device->requests, struct ioctl_call, dev_entry )
+    LIST_FOR_EACH_ENTRY_SAFE( ioctl, next, &device->requests, struct ioctl_call, dev_entry )
     {
         list_remove( &ioctl->mgr_entry );
         set_ioctl_result( ioctl, STATUS_FILE_DELETED, NULL, 0 );




More information about the wine-cvs mailing list