--- file.c.cvs	Wed Apr 24 14:48:15 2002
+++ file.c	Wed Apr 24 14:42:14 2002
@@ -344,8 +344,12 @@
     ret = wine_server_handle_to_fd( handle, access, &fd, type, flags );
     if (ret) SetLastError( RtlNtStatusToDosError(ret) );
 
-    if (  ( (access & GENERIC_READ)  && (*flags & FD_FLAG_RECV_SHUTDOWN ) ) ||
-          ( (access & GENERIC_WRITE) && (*flags & FD_FLAG_SEND_SHUTDOWN ) ) )
+    if ( flags && 
+         (
+	  ( (access & GENERIC_READ)  && (*flags & FD_FLAG_RECV_SHUTDOWN ) ) ||
+          ( (access & GENERIC_WRITE) && (*flags & FD_FLAG_SEND_SHUTDOWN ) )
+         )
+       )
     {
         close (fd);
         SetLastError ( ERROR_PIPE_NOT_CONNECTED );
