diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2018-03-02 23:40:36 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2018-03-02 23:40:36 +0100 |
commit | df14d97fff68fc9597b5769a3a077c73e38859d7 (patch) | |
tree | 797962d9b13220483e123cd999de1b7f71e5e4fc | |
parent | be6da79713fcfd157cf84d9efb6d4c4afd6ccf33 (diff) | |
download | cygnal-df14d97fff68fc9597b5769a3a077c73e38859d7.tar.gz cygnal-df14d97fff68fc9597b5769a3a077c73e38859d7.tar.bz2 cygnal-df14d97fff68fc9597b5769a3a077c73e38859d7.zip |
Cygwin: AF_UNIX: drop try/except block in bind method
The caller already does it anyway.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/fhandler_socket_unix.cc | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 2a439001c..36a3cb3c4 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -604,35 +604,29 @@ fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, int fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) { - __try - { - sun_name_t sun (name, namelen); - bool unnamed = (sun.un_len == sizeof sun.un.sun_family); - HANDLE pipe = NULL; + sun_name_t sun (name, namelen); + bool unnamed = (sun.un_len == sizeof sun.un.sun_family); + HANDLE pipe = NULL; - if (get_handle ()) - { - set_errno (EINVAL); - __leave; - } - gen_pipe_name (); - pipe = create_pipe (); - if (pipe) - { - file = unnamed ? autobind (&sun) : create_file (&sun); - if (!file) - { - NtClose (pipe); - __leave; - } - set_io_handle (pipe); - set_sun_path (&sun); - return 0; - } + /* If we have a handle, we're already bound. */ + if (get_handle () || sun.un.sun_family != AF_UNIX) + { + set_errno (EINVAL); + return -1; } - __except (EFAULT) {} - __endtry - return -1; + gen_pipe_name (); + pipe = create_pipe (); + if (!pipe) + return -1; + file = unnamed ? autobind (&sun) : create_file (&sun); + if (!file) + { + NtClose (pipe); + return -1; + } + set_io_handle (pipe); + set_sun_path (&sun); + return 0; } int |