diff options
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r-- | lib/Handle.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc index fe58b48..9f369ce 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.69 2004-04-30 08:21:36 pixel Exp $ */ +/* $Id: Handle.cc,v 1.70 2004-05-01 11:48:57 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -102,6 +102,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) { ssize_t r, tr = 0; bool done, full = false; const char * buf = (const char *)cbuf; + + if (closed) { + throw IOGeneral("Unable to write: handle `" + GetName() + "' is closed."); + } if (!count) return 0; @@ -151,6 +155,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) { ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { ssize_t r; + if (closed) { + throw IOGeneral("Unable to read: handle `" + GetName() + "' is closed."); + } + if (!count) return 0; |