diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Handle.cc | 13 | ||||
-rw-r--r-- | lib/Input.cc | 5 | ||||
-rw-r--r-- | lib/Main.cc | 1 |
3 files changed, 14 insertions, 5 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) { diff --git a/lib/Input.cc b/lib/Input.cc index ed549ec..d846acd 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -5,6 +5,8 @@ #include <sys/stat.h> #include <fcntl.h> +#define DEBUG + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -70,10 +72,11 @@ Input::Input(const String & no) throw (GeneralException) : n(no) { #ifdef DEBUG - fprintf(stderr, _("Opening file %s, Input at %p\n"), no.to_charp(), this); + printm(M_BARE, String(_("Opening file")) + no + _("Input at %p\n"), this); #endif if (GetHandle() < 0) { + printm(M_BARE, "Got handle: %i\n", GetHandle()); throw IOGeneral(String(_("Error opening file ")) + no + _(" for reading: ") + strerror(errno)); } diff --git a/lib/Main.cc b/lib/Main.cc index 9e2891b..74b83cc 100644 --- a/lib/Main.cc +++ b/lib/Main.cc @@ -1,6 +1,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "Exceptions.h" #include "Main.h" #include "generic.h" //#include "gettext.h" |