Better fix for named pipe problem.
Bill Medland
billmedland at mercuryspeed.com
Mon Apr 14 14:42:16 CDT 2003
Bill Medland (billmedland at mercuryspeed.com)
Fix for client accessing a named pipe after the server closes it.
Index: wine/server/named_pipe.c
===================================================================
RCS file: /home/wine/wine/server/named_pipe.c,v
retrieving revision 1.22
diff -u -r1.22 named_pipe.c
--- wine/server/named_pipe.c 4 Apr 2003 22:26:34 -0000 1.22
+++ wine/server/named_pipe.c 14 Apr 2003 19:37:55 -0000
@@ -163,7 +163,19 @@
static struct fd *pipe_user_get_fd( struct object *obj )
{
struct pipe_user *user = (struct pipe_user *)obj;
- return (struct fd *)grab_object( user->fd );
+ /* Beware. If this is a client then the fd may be null */
+ if (user && user->fd)
+ return (struct fd *)grab_object( user->fd );
+ else
+ {
+ set_error (STATUS_PIPE_DISCONNECTED);
+ /* I presume that this is the correct value. Whatever is entered
here,
+ * it has to translate into ERROR_PIPE_NOT_CONNECTED by the time
+ * ReadFile returns.
+ * NB It is NOT STATUS_PIPE_BROKEN.
+ */
+ return 0;
+ }
}
static void pipe_user_destroy( struct object *obj)
Index: wine/server/fd.c
===================================================================
RCS file: /home/wine/wine/server/fd.c,v
retrieving revision 1.8
diff -u -r1.8 fd.c
--- wine/server/fd.c 26 Mar 2003 01:32:18 -0000 1.8
+++ wine/server/fd.c 14 Apr 2003 19:38:07 -0000
@@ -987,7 +987,10 @@
if ((obj = get_handle_obj( process, handle, access, NULL )))
{
- if (!(fd = get_obj_fd( obj ))) set_error( STATUS_OBJECT_TYPE_MISMATCH
);
+ fd = get_obj_fd (obj);
+ /* NB It is the object's responsibility to set the error if it
+ * has no fd
+ */
release_object( obj );
}
return fd;
--
Bill Medland
ACCPAC International, Inc.
medbi01 at accpac.com
Corporate: www.accpac.com
Hosted Services: www.accpaconline.com
More information about the wine-patches
mailing list