fixed handling of decompression errors, which was wrong but not catastrophly so in most cases
This commit is contained in:
parent
9c5bd49c3c
commit
8a698c5c6b
@ -21,11 +21,11 @@ sinfile=`basename "$infile"`
|
|||||||
case "$sinfile" in
|
case "$sinfile" in
|
||||||
*.*)
|
*.*)
|
||||||
cp "$infile" "$outdir/$sinfile" || exit 1
|
cp "$infile" "$outdir/$sinfile" || exit 1
|
||||||
$uncomp "$outdir/$sinfile"
|
$uncomp "$outdir/$sinfile" || exit 1
|
||||||
uncompressed=`echo $outdir/*`
|
uncompressed=`echo $outdir/*`
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
$uncomp < "$infile" > "$outdir/$sinfile"
|
$uncomp < "$infile" > "$outdir/$sinfile" || exit 1
|
||||||
uncompressed="$outdir/$sinfile"
|
uncompressed="$outdir/$sinfile"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@ -102,8 +102,11 @@ static bool uncompressfile(RclConfig *conf, const string& ifn,
|
|||||||
ExecCmd ex;
|
ExecCmd ex;
|
||||||
int status = ex.doexec(cmd, args, 0, &tfile);
|
int status = ex.doexec(cmd, args, 0, &tfile);
|
||||||
if (status || tfile.empty()) {
|
if (status || tfile.empty()) {
|
||||||
LOGERR(("uncompressfile: doexec: failed for [%s] status 0x%x\n", ifn.c_str(), status));
|
LOGERR(("uncompressfile: doexec: failed for [%s] status 0x%x\n",
|
||||||
rmdir(tdir.c_str());
|
ifn.c_str(), status));
|
||||||
|
if (wipedir(tdir.c_str())) {
|
||||||
|
LOGERR(("uncompressfile: wipedir failed\n"));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (tfile[tfile.length() - 1] == '\n')
|
if (tfile[tfile.length() - 1] == '\n')
|
||||||
@ -619,7 +622,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
|
|||||||
return FIAgain;
|
return FIAgain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Automatic cleanup of iDocTempFile's temp dir
|
||||||
class DirWiper {
|
class DirWiper {
|
||||||
public:
|
public:
|
||||||
string dir;
|
string dir;
|
||||||
@ -637,6 +640,11 @@ class DirWiper {
|
|||||||
// We do the usual internfile stuff: create a temporary directory,
|
// We do the usual internfile stuff: create a temporary directory,
|
||||||
// then create an interner and call internfile.
|
// then create an interner and call internfile.
|
||||||
// We then write the data out of the resulting document into the output file.
|
// We then write the data out of the resulting document into the output file.
|
||||||
|
// There are two temporary objects:
|
||||||
|
// - The internfile temporary directory gets destroyed before we
|
||||||
|
// return by the DirWiper object
|
||||||
|
// - The output temporary file which is held in a reference-counted
|
||||||
|
// object and will be deleted when done with.
|
||||||
bool FileInterner::idocTempFile(TempFile& otemp, RclConfig *cnf,
|
bool FileInterner::idocTempFile(TempFile& otemp, RclConfig *cnf,
|
||||||
const string& fn,
|
const string& fn,
|
||||||
const string& ipath,
|
const string& ipath,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user