>From 57c1342c683df3207094e8ec660e72812be37f9c Mon Sep 17 00:00:00 2001
From: Martin Sustrik <[email protected]>
Date: Tue, 12 Jul 2011 13:05:58 +0200
Subject: [PATCH] Bug with setting options on SUB socket fixed

Signed-off-by: Martin Sustrik <[email protected]>
---
 src/sub.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/sub.cpp b/src/sub.cpp
index 2a1454a..81082a2 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -38,6 +38,11 @@ zmq::sub_t::~sub_t ()
 int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
     size_t optvallen_)
 {
+    if (option_ != ZMQ_SUBSCRIBE && option_ != ZMQ_UNSUBSCRIBE) {
+        errno = EINVAL;
+        return -1;
+    }
+
     //  Create the subscription message.
     msg_t msg;
     int rc = msg.init_size (optvallen_ + 1);
-- 
1.7.0.4

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to