1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-17 22:38:33 +01:00

Prevent infinite scanning, falling for symlink recursion.

This commit is contained in:
Christian Muehlhaeuser 2014-11-14 18:02:49 +01:00
parent 233bbcd6f9
commit 0ac509e827
2 changed files with 5 additions and 5 deletions

View File

@ -61,9 +61,9 @@ DirLister::scanDir( QDir dir, int depth )
}
tDebug( LOGVERBOSE ) << "DirLister::scanDir scanning:" << dir.canonicalPath();
if ( !dir.exists() )
if ( !dir.exists() || m_processedDirs.contains( dir.canonicalPath() ) )
{
tDebug( LOGVERBOSE ) << "Dir no longer exists, not scanning";
tDebug( LOGVERBOSE ) << "Dir no longer exists or already scanned, ignoring";
m_opcount--;
if ( m_opcount == 0 )
@ -72,18 +72,17 @@ DirLister::scanDir( QDir dir, int depth )
return;
}
QFileInfoList filteredEntries;
m_processedDirs << dir.canonicalPath();
QFileInfoList filteredEntries;
dir.setFilter( QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
dir.setSorting( QDir::Name );
filteredEntries = dir.entryInfoList();
foreach ( const QFileInfo& di, filteredEntries )
emit fileToScan( di );
dir.setFilter( QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot );
filteredEntries = dir.entryInfoList();
foreach ( const QFileInfo& di, filteredEntries )
{
const QString canonical = di.canonicalFilePath();

View File

@ -72,6 +72,7 @@ private slots:
private:
QStringList m_dirs;
QSet< QString > m_processedDirs;
uint m_opcount;
QMutex m_deletingMutex;