This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Ensure that a blocking send() on a socket returns (with success) if a signal is handled mid-transition and SA_RESTART is not set.


Hi Erik,

[vacation-induced late reply]


On May 11 16:05, Erik M. Bray wrote:
> ---
>  winsup/cygwin/fhandler_socket.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
> index f3d1d69..c7ed681 100644
> --- a/winsup/cygwin/fhandler_socket.cc
> +++ b/winsup/cygwin/fhandler_socket.cc
> @@ -1851,7 +1851,7 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags)
>  	  if (get_socket_type () != SOCK_STREAM || ret < out_len)
>  	    break;
>  	}
> -      else if (is_nonblocking () || err != WSAEWOULDBLOCK)
> +      else if (is_nonblocking () || WSAGetLastError() != WSAEWOULDBLOCK)
>  	break;
>      }

Thanks for catching!  Given that the loop isn't guaranteed to set `err'
correctly all the time, I wonder if we shouldn't get rid of `err'
completely.  Checking WSAGetLastError is plain user-space memory access
anyway, and there's no reason the compiler can't optimize this by
itself.

Also, I would prefer to have a shorter subject (<=72 chars or so) and
to describe this in the log message a bit more detailed.

Would you like to provide another patch along these lines?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]