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
cdbe1207
Commit
cdbe1207
authored
May 02, 2019
by
jean-airoldie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: No invalid pointer handling for zmq_poller_fd
Solution: Add some and document it.
parent
19dd8195
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
zmq_poller.txt
doc/zmq_poller.txt
+2
-0
zmq.cpp
src/zmq.cpp
+7
-1
test_poller.cpp
tests/test_poller.cpp
+11
-0
No files found.
doc/zmq_poller.txt
View file @
cdbe1207
...
...
@@ -249,6 +249,8 @@ No registered event was signalled before the timeout was reached.
On _zmq_poller_fd:
*EINVAL*::
The poller has no associated file descriptor.
*EFAULT*::
The provided 'poller' did not point to a valid poller.
EXAMPLE
-------
...
...
src/zmq.cpp
View file @
cdbe1207
...
...
@@ -1280,7 +1280,13 @@ int zmq_poller_wait_all (void *poller_,
int
zmq_poller_fd
(
void
*
poller_
)
{
return
static_cast
<
zmq
::
socket_poller_t
*>
(
poller_
)
->
signaler_fd
();
if
(
!
poller_
||
!
(
static_cast
<
zmq
::
socket_poller_t
*>
(
poller_
)
->
check_tag
()))
{
errno
=
EFAULT
;
return
-
1
;
}
else
{
return
static_cast
<
zmq
::
socket_poller_t
*>
(
poller_
)
->
signaler_fd
();
}
}
// Peer-specific state
...
...
tests/test_poller.cpp
View file @
cdbe1207
...
...
@@ -195,6 +195,12 @@ void test_null_poller_pointers_wait_all_indirect ()
EFAULT
,
zmq_poller_wait_all
(
&
null_poller
,
&
event
,
1
,
0
));
}
void
test_null_poller_pointer_poller_fd
()
{
void
*
null_poller
=
NULL
;
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_fd
(
&
null_poller
));
}
void
test_null_socket_pointers
()
{
void
*
poller
=
zmq_poller_new
();
...
...
@@ -269,6 +275,8 @@ void test_call_poller_fd_no_signaler ()
TEST_ASSERT_FAILURE_ERRNO
(
EINVAL
,
zmq_poller_fd
(
poller
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
test_context_socket_close
(
socket
);
}
...
...
@@ -284,6 +292,8 @@ void test_call_poller_fd ()
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_fd
(
poller
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
test_context_socket_close
(
socket
);
}
...
...
@@ -656,6 +666,7 @@ int main (void)
RUN_TEST
(
test_null_poller_pointers_wait_indirect
);
RUN_TEST
(
test_null_poller_pointers_wait_all_direct
);
RUN_TEST
(
test_null_poller_pointers_wait_all_indirect
);
RUN_TEST
(
test_null_poller_pointer_poller_fd
);
RUN_TEST
(
test_null_socket_pointers
);
...
...
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