A simple patch for strigi
Jaime Torres
jtamate at gmail.com
Tue Oct 27 19:30:18 GMT 2009
Hi,
As I'm not able to use reviewboard today, I'll ask here:
The first part is to avoid a DIR leak.
The second part is to avoid to use the same variable name into two nested
loops. gcc may work perfectly fine with it, but probably other compilers
(will) not.
--- strigi/src/luceneindexer/luceneindexer.cpp (revision 1041313)
+++ strigi/src/luceneindexer/luceneindexer.cpp (copia de trabajo)
@@ -46,6 +46,7 @@ checkIndexdirIsEmpty(const char* dir) {
while (de) {
if (strcmp(de->d_name, "..") && strcmp(de->d_name, ".")) {
fprintf(stderr, "Directory %s is not empty.\n", dir);
+ closedir(d);
return false;
}
de = readdir(d);
--- strigi/src/daemon/eventlistener/fslistener.cpp (revision 1041313)
+++ strigi/src/daemon/eventlistener/fslistener.cpp (copia de trabajo)
@@ -388,14 +388,14 @@ void FsListener::reindex()
calculateDiff(m_indexedDirs, reindexDirs, dirsDeleted, dirsCreated);
- for (set<string>::iterator iter = dirsCreated.begin();
- iter != dirsCreated.end() && !reindexReq(); ++iter)
+ for (set<string>::iterator iter1 = dirsCreated.begin();
+ iter1 != dirsCreated.end() && !reindexReq(); ++iter1)
{
DirLister lister(m_pAnalyzerConfiguration);
string path;
vector<pair<string, struct stat> > dirs;
- lister.startListing (*iter);
+ lister.startListing (*iter1);
int ret = lister.nextDir(path, dirs);
while (ret != -1) {
// The rest of the affected loop:
vector<pair<string, struct stat> >::iterator iter;
for (iter = dirs.begin(); iter != dirs.end(); iter++) {
struct stat stats = iter->second;
if (S_ISDIR(stats.st_mode)) {//dir
set<string> toWatch;
recursivelyMonitor (iter->first, toWatch, events);
// add new watches
addWatches (toWatch);
dirsMonitored.insert (iter->first);
}
else if (S_ISREG(stats.st_mode)) {
//file
events.push_back (new Event (Event::CREATED, iter-
>first));
}
}
ret = lister.nextDir(path, dirs);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20091027/39fa834c/attachment.sig>
More information about the kde-core-devel
mailing list