From b4cb5e23c0a235d61d4a63acf4624f96f20f620b Mon Sep 17 00:00:00 2001 From: frsyuki Date: Fri, 7 Aug 2009 11:28:23 +0900 Subject: [PATCH] fix Makefile.am --- cpp/Makefile.am | 2 ++ example/stream.cc | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cpp/Makefile.am b/cpp/Makefile.am index 5efac3f8..f6308328 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -39,10 +39,12 @@ msgpack/zone.hpp: msgpack/zone.hpp.erb MOSTLYCLEANFILES = \ msgpack/type/tuple.hpp \ + msgpack/type/define.hpp \ msgpack/zone.hpp EXTRA_DIST = \ msgpack/type/tuple.hpp.erb \ + msgpack/type/define.hpp.erb \ msgpack/zone.hpp.erb libmsgpack_la_LIBADD = -L../c -lmsgpackc diff --git a/example/stream.cc b/example/stream.cc index 1e2e733b..2241935c 100644 --- a/example/stream.cc +++ b/example/stream.cc @@ -22,14 +22,14 @@ public: ssize_t count = read(m_sock, m_pac.buffer(), m_pac.buffer_capacity()); - if(count < 0) { + if(count <= 0) { + if(count == 0) { + throw std::runtime_error("connection closed"); + } if(errno == EAGAIN || errno == EINTR) { return; - } else { - throw std::runtime_error(strerror(errno)); } - } else if(count == 0) { - throw std::runtime_error("connection closed"); + throw std::runtime_error(strerror(errno)); } m_pac.buffer_consumed(count);