summaryrefslogtreecommitdiff
path: root/src/zmq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zmq.cpp')
-rw-r--r--src/zmq.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 61f942d..85f7d62 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -284,7 +284,7 @@ void *zmq_init (int io_threads_)
int zmq_term (void *ctx_)
{
- if (!ctx_) {
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
errno = EFAULT;
return -1;
}
@@ -310,7 +310,7 @@ int zmq_term (void *ctx_)
void *zmq_socket (void *ctx_, int type_)
{
- if (!ctx_) {
+ if (!ctx_ || !((zmq::ctx_t*) ctx_)->check_tag ()) {
errno = EFAULT;
return NULL;
}
@@ -319,8 +319,8 @@ void *zmq_socket (void *ctx_, int type_)
int zmq_close (void *s_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
((zmq::socket_base_t*) s_)->close ();
@@ -330,8 +330,8 @@ int zmq_close (void *s_)
int zmq_setsockopt (void *s_, int option_, const void *optval_,
size_t optvallen_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
return (((zmq::socket_base_t*) s_)->setsockopt (option_, optval_,
@@ -340,8 +340,8 @@ int zmq_setsockopt (void *s_, int option_, const void *optval_,
int zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
return (((zmq::socket_base_t*) s_)->getsockopt (option_, optval_,
@@ -350,8 +350,8 @@ int zmq_getsockopt (void *s_, int option_, void *optval_, size_t *optvallen_)
int zmq_bind (void *s_, const char *addr_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
return (((zmq::socket_base_t*) s_)->bind (addr_));
@@ -359,8 +359,8 @@ int zmq_bind (void *s_, const char *addr_)
int zmq_connect (void *s_, const char *addr_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
return (((zmq::socket_base_t*) s_)->connect (addr_));
@@ -368,8 +368,8 @@ int zmq_connect (void *s_, const char *addr_)
int zmq_send (void *s_, zmq_msg_t *msg_, int flags_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
return (((zmq::socket_base_t*) s_)->send (msg_, flags_));
@@ -377,8 +377,8 @@ int zmq_send (void *s_, zmq_msg_t *msg_, int flags_)
int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_)
{
- if (!s_) {
- errno = EFAULT;
+ if (!s_ || !((zmq::socket_base_t*) s_)->check_tag ()) {
+ errno = ENOTSOCK;
return -1;
}
return (((zmq::socket_base_t*) s_)->recv (msg_, flags_));