omidaladini/barn — pull request #2 by streadway (2012-12-05 12:45:12+00:00)
Title: Error handling

rtaild:

* report and exit with 2 on zmq exception

rtailp:

* argc includes the program name at 0, so 2 args should check argc < 3
* zmq::context_t and zmq::message_t clean their resources in their
destructors, called when leaving try try {} scope.
* fgets returns NULL on feof and ferror, so ferror inside the while
will never be reached, and feof will leave the buffer unmodified.
Note: ferror will leave the line buffer in an undefined state -
partial reads are possible.
* EOF considered non-error termination case.
* report and exit with 2 on zmq exception