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:
parent
233bbcd6f9
commit
0ac509e827
@ -61,9 +61,9 @@ DirLister::scanDir( QDir dir, int depth )
|
|||||||
}
|
}
|
||||||
|
|
||||||
tDebug( LOGVERBOSE ) << "DirLister::scanDir scanning:" << dir.canonicalPath();
|
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--;
|
m_opcount--;
|
||||||
if ( m_opcount == 0 )
|
if ( m_opcount == 0 )
|
||||||
@ -72,18 +72,17 @@ DirLister::scanDir( QDir dir, int depth )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfoList filteredEntries;
|
m_processedDirs << dir.canonicalPath();
|
||||||
|
|
||||||
|
QFileInfoList filteredEntries;
|
||||||
dir.setFilter( QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
|
dir.setFilter( QDir::Files | QDir::Readable | QDir::NoDotAndDotDot );
|
||||||
dir.setSorting( QDir::Name );
|
dir.setSorting( QDir::Name );
|
||||||
filteredEntries = dir.entryInfoList();
|
filteredEntries = dir.entryInfoList();
|
||||||
|
|
||||||
foreach ( const QFileInfo& di, filteredEntries )
|
foreach ( const QFileInfo& di, filteredEntries )
|
||||||
emit fileToScan( di );
|
emit fileToScan( di );
|
||||||
|
|
||||||
dir.setFilter( QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot );
|
dir.setFilter( QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot );
|
||||||
filteredEntries = dir.entryInfoList();
|
filteredEntries = dir.entryInfoList();
|
||||||
|
|
||||||
foreach ( const QFileInfo& di, filteredEntries )
|
foreach ( const QFileInfo& di, filteredEntries )
|
||||||
{
|
{
|
||||||
const QString canonical = di.canonicalFilePath();
|
const QString canonical = di.canonicalFilePath();
|
||||||
|
@ -72,6 +72,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_dirs;
|
QStringList m_dirs;
|
||||||
|
QSet< QString > m_processedDirs;
|
||||||
|
|
||||||
uint m_opcount;
|
uint m_opcount;
|
||||||
QMutex m_deletingMutex;
|
QMutex m_deletingMutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user