Windows, firefox plugin:make sure the temp files are closed before remove
This commit is contained in:
parent
0489df84e2
commit
a1138dd9e5
@ -58,14 +58,13 @@ public:
|
||||
{}
|
||||
|
||||
// Read input line, strip it of eol and return as c++ string
|
||||
bool readLine(string& line)
|
||||
{
|
||||
bool readLine(ifstream& input, string& line) {
|
||||
static const int LL = 2048;
|
||||
char cline[LL];
|
||||
cline[0] = 0;
|
||||
m_input.getline(cline, LL-1);
|
||||
if (!m_input.good()) {
|
||||
if (m_input.bad()) {
|
||||
input.getline(cline, LL-1);
|
||||
if (!input.good()) {
|
||||
if (input.bad()) {
|
||||
LOGERR("WebQueueDotFileRead: input.bad()\n");
|
||||
}
|
||||
return false;
|
||||
@ -81,12 +80,12 @@ public:
|
||||
}
|
||||
|
||||
// Process a Web queue dot file and set interesting stuff in the doc
|
||||
bool toDoc(Rcl::Doc& doc)
|
||||
{
|
||||
bool toDoc(Rcl::Doc& doc) {
|
||||
string line;
|
||||
ifstream input;
|
||||
|
||||
m_input.open(m_fn.c_str(), ios::in);
|
||||
if (!m_input.good()) {
|
||||
input.open(m_fn.c_str(), ios::in);
|
||||
if (!input.good()) {
|
||||
LOGERR("WebQueueDotFile: open failed for [" << m_fn << "]\n");
|
||||
return false;
|
||||
}
|
||||
@ -95,13 +94,13 @@ public:
|
||||
// - url
|
||||
// - hit type: we only know about Bookmark and WebHistory for now
|
||||
// - content-type.
|
||||
if (!readLine(line))
|
||||
if (!readLine(input, line))
|
||||
return false;
|
||||
doc.url = line;
|
||||
if (!readLine(line))
|
||||
if (!readLine(input, line))
|
||||
return false;
|
||||
doc.meta[Rcl::Doc::keybght] = line;
|
||||
if (!readLine(line))
|
||||
if (!readLine(input, line))
|
||||
return false;
|
||||
doc.mimetype = line;
|
||||
|
||||
@ -120,7 +119,7 @@ public:
|
||||
// parse, and finally insert the key/value pairs into the doc
|
||||
// meta[] array
|
||||
for (;;) {
|
||||
if (!readLine(line)) {
|
||||
if (!readLine(input, line)) {
|
||||
// Eof hopefully
|
||||
break;
|
||||
}
|
||||
@ -171,7 +170,6 @@ public:
|
||||
RclConfig *m_conf;
|
||||
ConfSimple m_fields;
|
||||
string m_fn;
|
||||
ifstream m_input;
|
||||
};
|
||||
|
||||
// Initialize. Compute paths and create a temporary directory that will be
|
||||
@ -263,7 +261,8 @@ bool WebQueueIndexer::index()
|
||||
LOGDEB("WebQueueIndexer::processqueue: [" << m_queuedir << "]\n");
|
||||
m_config->setKeyDir(m_queuedir);
|
||||
if (!path_makepath(m_queuedir, 0700)) {
|
||||
LOGERR("WebQueueIndexer:: can't create queuedir [" << m_queuedir << "] errno " << errno << "\n");
|
||||
LOGERR("WebQueueIndexer:: can't create queuedir [" << m_queuedir <<
|
||||
"] errno " << errno << "\n");
|
||||
return false;
|
||||
}
|
||||
if (!m_cache || !m_cache->cc()) {
|
||||
@ -349,7 +348,8 @@ bool WebQueueIndexer::indexFiles(list<string>& files)
|
||||
it++; continue;
|
||||
}
|
||||
if (!S_ISREG(st.st_mode)) {
|
||||
LOGDEB("WebQueueIndexer::indexfiles: skipping [" << *it << "] (nr)\n");
|
||||
LOGDEB("WebQueueIndexer::indexfiles: skipping [" << *it <<
|
||||
"] (nr)\n");
|
||||
it++; continue;
|
||||
}
|
||||
|
||||
@ -464,7 +464,8 @@ WebQueueIndexer::processone(const string &path,
|
||||
goto out;
|
||||
}
|
||||
if (!m_cache->cc()->put(udi, &dotfile.m_fields, fdata, 0)) {
|
||||
LOGERR("WebQueueIndexer::prc1: cache_put failed; " << m_cache->cc()->getReason() << "\n");
|
||||
LOGERR("WebQueueIndexer::prc1: cache_put failed; " <<
|
||||
m_cache->cc()->getReason() << "\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user