diff options
author | pixel <pixel> | 2003-07-13 01:32:43 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-07-13 01:32:43 +0000 |
commit | 2a1525eb8cef13000fc10126f770541b2115ff89 (patch) | |
tree | be6312f2dd6fe8454e8a7574f95b5eb44564d585 /lib | |
parent | c477f1a35d23a9a3d3e29622b013532343c078cc (diff) |
Misc fixes
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" |