[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/strigi/src/streamanalyzer
From: Evgeny Egorochkin <phreedom.stdin () gmail ! com>
Date: 2009-10-24 20:24:11
Message-ID: 1256415851.667561.5677.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1039872 by evgeny:
Fix for a race condition in DirLister::Private::nextDir. Patch by Fabrice Ménard.
CCMAIL: menard.fabrice@orange.fr
M +12 -6 filelister.cpp
--- trunk/kdesupport/strigi/src/streamanalyzer/filelister.cpp #1039871:1039872
@@ -271,18 +271,24 @@
int
DirLister::Private::nextDir(std::string& path,
std::vector<std::pair<std::string, struct stat> >& dirs) {
- // check if there are more directories to work on
- if (todoPaths.size() == 0) {
- return -1;
- }
string entryname;
string entrypath;
size_t entrypathlength;
+ // check if there are more directories to work on
+ bool end = false;
// open the directory
STRIGI_MUTEX_LOCK(&mutex);
- path.assign(todoPaths.front());
- todoPaths.pop_front();
+ if (!todoPaths.empty()) {
+ path.assign(todoPaths.front());
+ todoPaths.pop_front();
+ }
+ else {
+ end = true;
+ }
STRIGI_MUTEX_UNLOCK(&mutex);
+ if (end) {
+ return -1;
+ }
entrypathlength = path.length()+1;
entrypath.assign(path);
entrypath.append("/");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic