summaryrefslogtreecommitdiff
path: root/lib/Handle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r--lib/Handle.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index d366382..69f6111 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -209,12 +209,12 @@ void Handle::close() throw (GeneralException) {
if (c == DEFLATE) {
err = deflateEnd(&zstrm);
if (err != Z_OK) {
- throw (String(_("Error during deflateEnd: ")) + zstrm.msg);
+ throw GeneralException(String(_("Error during deflateEnd: ")) + zstrm.msg);
}
} else {
err = inflateEnd(&zstrm);
if (err != Z_OK) {
- throw (String(_("Error during inflateEnd: ")) + zstrm.msg);
+ throw GeneralException(String(_("Error during inflateEnd: ")) + zstrm.msg);
}
}
err = ::close(h);
@@ -273,8 +273,13 @@ bool Handle::CanWatch(void) const {
return true;
}
-int Handle::Dup() const {
- return dup(h);
+int Handle::Dup() const throw (GeneralException) {
+ int d;
+
+ if ((d = dup(h)) < 0) {
+ throw IOGeneral(String(_("Error dupping file `")) + GetName() + _("' (handle ") + h + "): " + strerror(errno) + " (" + errno + ")");
+ }
+ return d;
}
void Handle::SetZ(int az) throw (GeneralException) {