Permalink
Browse files

repro code for issues 507, 508 and 509

  • Loading branch information...
1 parent 37a06a1 commit 0e957ea9bbdbf59707863fa85d3be7e52e01ceed @chuckremes chuckremes committed Feb 19, 2013
Showing with 83 additions and 0 deletions.
  1. +27 −0 507/3-2/issue.c
  2. +28 −0 508/3-2/issue.c
  3. +28 −0 509/3-2/issue.c
View
@@ -0,0 +1,27 @@
+//
+// A socket fails to unbind from a bound inproc endpoint.
+// This works for other transport types.
+//
+// gcc -lzmq issue.c
+// chmod +x a.out
+// ./a.out
+//
+#include <zmq.h>
+
+#include <assert.h>
+#include <stdio.h>
+
+
+
+int main (void)
+{
+ int rc;
+ void *context = zmq_init (1);
+ void *socket = zmq_socket (context, ZMQ_PUB);
+ assert (0 == zmq_bind (socket, "inproc://some_addr"));
+ assert (0 == zmq_unbind (socket, "inproc://some_addr"));
+
+ zmq_close (socket);
+ zmq_term (context);
+ return (0);
+}
View
@@ -0,0 +1,28 @@
+//
+// Unbinding a socket from an unknown endpoint should
+// return EINVAL. Instead, it returns ENOENT.
+//
+// gcc -lzmq issue.c
+// chmod +x a.out
+// ./a.out
+//
+#include <zmq.h>
+
+#include <assert.h>
+#include <stdio.h>
+
+
+
+int main (void)
+{
+ int rc;
+ void *context = zmq_init (1);
+ void *socket = zmq_socket (context, ZMQ_PUB);
+ assert (-1 == zmq_unbind (socket, "ipc:///tmp/some_ipc"));
+ assert (ENOENT == zmq_errno () ); // succeeds but should fail
+ assert (EINVAL == zmq_errno () ); // fails but should succeed
+
+ zmq_close (socket);
+ zmq_term (context);
+ return (0);
+}
View
@@ -0,0 +1,28 @@
+//
+// Disconnecting a socket from an unknown endpoint should
+// return EINVAL. Instead, it returns ENOENT.
+//
+// gcc -lzmq issue.c
+// chmod +x a.out
+// ./a.out
+//
+#include <zmq.h>
+
+#include <assert.h>
+#include <stdio.h>
+
+
+
+int main (void)
+{
+ int rc;
+ void *context = zmq_init (1);
+ void *socket = zmq_socket (context, ZMQ_PUB);
+ assert (-1 == zmq_disconnect (socket, "ipc:///tmp/some_ipc"));
+ assert (ENOENT == zmq_errno () ); // succeeds but should fail
+ assert (EINVAL == zmq_errno () ); // fails but should succeed
+
+ zmq_close (socket);
+ zmq_term (context);
+ return (0);
+}

0 comments on commit 0e957ea

Please sign in to comment.