summaryrefslogtreecommitdiff
path: root/lib/Input.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Input.cc')
-rw-r--r--lib/Input.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Input.cc b/lib/Input.cc
index 7427c38..e9b859a 100644
--- a/lib/Input.cc
+++ b/lib/Input.cc
@@ -20,12 +20,12 @@
#define S_ISREG(x) 1
#endif
-#define DEBUG
-
#define BUILTIN_SIG 0x5141504e
+static Input::openresults_t gresults;
+
Input::Input(const String & no) throw (GeneralException) :
- Handle(no.strlen() ? wrapopen(no, &results) : dup(0)),
+ Handle(no.strlen() ? wrapopen(no, &gresults) : dup(0)),
n(no) {
#ifdef DEBUG
@@ -36,6 +36,9 @@ Input::Input(const String & no) throw (GeneralException) :
throw IOGeneral(String(_("Error opening file ")) + no + _(" for reading: ") + strerror(errno));
}
+ results = gresults;
+
+ fromarchive = false;
if (results.name == "") {
struct stat s;
fstat(GetHandle(), &s);
@@ -51,6 +54,7 @@ Input::Input(const String & no) throw (GeneralException) :
read(&size, 4);
date_modif = 0;
SetZ();
+ fromarchive = true;
}
}
@@ -86,7 +90,7 @@ time_t Input::GetModif() const {
}
off_t Input::seek(off_t offset, int whence) throw (GeneralException) {
- if (results.name == "") {
+ if (!fromarchive) {
if ((itell = lseek(GetHandle(), offset, whence)) < 0) {
throw IOGeneral(String(_("Error seeking file ")) + GetName() + _(": ") + strerror(errno));
}
@@ -119,7 +123,7 @@ int Input::wrapopen(const String & fname, openresults_t * results) {
}
void Input::SetZ(int l) throw(GeneralException) {
- if (results.name == "")
+ if (!fromarchive)
Handle::SetZ(l);
}