summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2018-03-02 23:40:36 +0100
committerCorinna Vinschen <corinna@vinschen.de>2018-03-02 23:40:36 +0100
commitdf14d97fff68fc9597b5769a3a077c73e38859d7 (patch)
tree797962d9b13220483e123cd999de1b7f71e5e4fc
parentbe6da79713fcfd157cf84d9efb6d4c4afd6ccf33 (diff)
downloadcygnal-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.cc48
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