diff options
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r-- | lib/Handle.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index dd22b5c..6f7c6e5 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -9,9 +9,7 @@ Handle::Handle(const Handle & nh) : h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(false), nonblock(false) { } Handle::~Handle() { - if (h >= 0) { - ::close(h); - } + close(); } Handle::Handle(int nh) : h(nh), closed(false) { } @@ -60,7 +58,7 @@ ssize_t Handle::write(const void *buf, size_t count) throw (GeneralException) { ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { ssize_t r; - + errno = 0; if ((r = ::read(h, buf, count)) < 0) { if ((!errno) || (errno = EAGAIN)) { @@ -73,8 +71,7 @@ ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { } if (!r) { - ::close(h); - closed = true; + close(); } return r; |