Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
22b2b9a2
Commit
22b2b9a2
authored
Dec 13, 2010
by
Dhammika Pathirana
Committed by
Martin Sustrik
Dec 13, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix overwriting errno on bind failure
Signed-off-by:
Dhammika Pathirana
<
dhammika@gmail.com
>
parent
a9d969a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
tcp_listener.cpp
src/tcp_listener.cpp
+5
-2
tcp_listener.hpp
src/tcp_listener.hpp
+3
-0
No files found.
src/tcp_listener.cpp
View file @
22b2b9a2
...
...
@@ -30,6 +30,7 @@
#ifdef ZMQ_HAVE_WINDOWS
zmq
::
tcp_listener_t
::
tcp_listener_t
()
:
has_file
(
false
),
s
(
retired_fd
)
{
memset
(
&
addr
,
0
,
sizeof
(
addr
));
...
...
@@ -151,6 +152,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
#endif
zmq
::
tcp_listener_t
::
tcp_listener_t
()
:
has_file
(
false
),
s
(
retired_fd
)
{
memset
(
&
addr
,
0
,
sizeof
(
addr
));
...
...
@@ -236,11 +238,12 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_,
errno_assert
(
rc
!=
-
1
);
// Bind the socket to the file path.
rc
=
bind
(
s
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
sockaddr_un
)
);
rc
=
bind
(
s
,
(
struct
sockaddr
*
)
&
addr
,
addr_len
);
if
(
rc
!=
0
)
{
close
();
return
-
1
;
}
has_file
=
true
;
// Listen for incomming connections.
rc
=
listen
(
s
,
backlog_
);
...
...
@@ -270,7 +273,7 @@ int zmq::tcp_listener_t::close ()
// If there's an underlying UNIX domain socket, get rid of the file it
// is associated with.
struct
sockaddr_un
*
su
=
(
struct
sockaddr_un
*
)
&
addr
;
if
(
AF_UNIX
==
su
->
sun_family
)
{
if
(
AF_UNIX
==
su
->
sun_family
&&
has_file
)
{
rc
=
::
unlink
(
su
->
sun_path
);
if
(
rc
!=
0
)
return
-
1
;
...
...
src/tcp_listener.hpp
View file @
22b2b9a2
...
...
@@ -57,6 +57,9 @@ namespace zmq
sockaddr_storage
addr
;
socklen_t
addr_len
;
// True, if the undelying file for UNIX domain socket exists.
bool
has_file
;
// Underlying socket.
fd_t
s
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment