Fix monitor_event() to work at all.

There are three versions of monitor_event(), all taking
variadic arguments. The original code just has the first one
creating a va_list and passing that va_list variadically to
the second one... which creates a new va_list and passes it
variadically to the third one... and of course everything
blows up when we try to pull a non-va_list argument off the
stack.

The correct approach matches the C standard library's use
of printf/vprintf, scanf/vscanf, and so on. Once you make
a va_list, you must pass it only to functions which expect
a va_list parameter.
This commit is contained in:
Arthur O'Dwyer
2012-08-24 16:42:31 -07:00
parent 537a802788
commit 7fadd708a0
6 changed files with 27 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
#define __ZMQ_SESSION_BASE_HPP_INCLUDED__
#include <string>
#include <stdarg.h>
#include "own.hpp"
#include "io_object.hpp"
@@ -67,6 +68,7 @@ namespace zmq
void terminated (zmq::pipe_t *pipe_);
void monitor_event (int event_, ...);
void va_monitor_event (int event_, va_list args);
protected: