|
a/src/internfile/internfile.cpp |
|
b/src/internfile/internfile.cpp |
|
... |
|
... |
100 |
|
100 |
|
101 |
// Execute command and retrieve output file name, check that it exists
|
101 |
// Execute command and retrieve output file name, check that it exists
|
102 |
ExecCmd ex;
|
102 |
ExecCmd ex;
|
103 |
int status = ex.doexec(cmd, args, 0, &tfile);
|
103 |
int status = ex.doexec(cmd, args, 0, &tfile);
|
104 |
if (status || tfile.empty()) {
|
104 |
if (status || tfile.empty()) {
|
105 |
LOGERR(("uncompressfile: doexec: failed for [%s] status 0x%x\n", ifn.c_str(), status));
|
105 |
LOGERR(("uncompressfile: doexec: failed for [%s] status 0x%x\n",
|
106 |
rmdir(tdir.c_str());
|
106 |
ifn.c_str(), status));
|
|
|
107 |
if (wipedir(tdir.c_str())) {
|
|
|
108 |
LOGERR(("uncompressfile: wipedir failed\n"));
|
|
|
109 |
}
|
107 |
return false;
|
110 |
return false;
|
108 |
}
|
111 |
}
|
109 |
if (tfile[tfile.length() - 1] == '\n')
|
112 |
if (tfile[tfile.length() - 1] == '\n')
|
110 |
tfile.erase(tfile.length() - 1, 1);
|
113 |
tfile.erase(tfile.length() - 1, 1);
|
111 |
return true;
|
114 |
return true;
|
|
... |
|
... |
617 |
return FIDone;
|
620 |
return FIDone;
|
618 |
else
|
621 |
else
|
619 |
return FIAgain;
|
622 |
return FIAgain;
|
620 |
}
|
623 |
}
|
621 |
|
624 |
|
622 |
|
625 |
// Automatic cleanup of iDocTempFile's temp dir
|
623 |
class DirWiper {
|
626 |
class DirWiper {
|
624 |
public:
|
627 |
public:
|
625 |
string dir;
|
628 |
string dir;
|
626 |
bool do_it;
|
629 |
bool do_it;
|
627 |
DirWiper(string d) : dir(d), do_it(true) {}
|
630 |
DirWiper(string d) : dir(d), do_it(true) {}
|
|
... |
|
... |
635 |
|
638 |
|
636 |
// Extract subdoc out of multidoc into temporary file.
|
639 |
// Extract subdoc out of multidoc into temporary file.
|
637 |
// We do the usual internfile stuff: create a temporary directory,
|
640 |
// We do the usual internfile stuff: create a temporary directory,
|
638 |
// then create an interner and call internfile.
|
641 |
// then create an interner and call internfile.
|
639 |
// We then write the data out of the resulting document into the output file.
|
642 |
// We then write the data out of the resulting document into the output file.
|
|
|
643 |
// There are two temporary objects:
|
|
|
644 |
// - The internfile temporary directory gets destroyed before we
|
|
|
645 |
// return by the DirWiper object
|
|
|
646 |
// - The output temporary file which is held in a reference-counted
|
|
|
647 |
// object and will be deleted when done with.
|
640 |
bool FileInterner::idocTempFile(TempFile& otemp, RclConfig *cnf,
|
648 |
bool FileInterner::idocTempFile(TempFile& otemp, RclConfig *cnf,
|
641 |
const string& fn,
|
649 |
const string& fn,
|
642 |
const string& ipath,
|
650 |
const string& ipath,
|
643 |
const string& mtype)
|
651 |
const string& mtype)
|
644 |
{
|
652 |
{
|