Commit 42f7a32d authored by Michael Reeves's avatar Michael Reeves

Fix 252250 only try to read normal files

BUG:352250
FIXED-IN:1.7.90
parent c68921e5
......@@ -341,6 +341,10 @@ bool SourceData::FileData::readFile(const QString& filename)
}
FileAccess fa(filename);
if(!fa.isNormal())
return true;
m_size = fa.sizeForReading();
char* pBuf;
m_pBuf = pBuf = new char[m_size + 100]; // Alloc 100 byte extra: Safety hack, not nice but does no harm.
......
......@@ -331,6 +331,11 @@ bool FileAccess::isValid() const
return !m_filePath.isEmpty() || m_bValidData;
}
bool FileAccess::isNormal() const
{
return isFile() || isDir() || isSymLink();
}
bool FileAccess::isFile() const
{
if(parent() || !isLocal())
......@@ -497,6 +502,10 @@ static bool interruptableReadFile(QFile& f, void* pDestBuffer, qint64 maxLength)
bool FileAccess::readFile(void* pDestBuffer, qint64 maxLength)
{
//Avoid hang on linux for special files.
if(!isNormal())
return true;
if(!m_localCopy.isEmpty())
{
QFile f(m_localCopy);
......
......@@ -45,6 +45,7 @@ public:
FileAccess( const QString& name, bool bWantToWrite=false ); // name: local file or dirname or url (when supported)
void setFile( const QString& name, bool bWantToWrite=false );
bool isNormal() const;
bool isValid() const;
bool isFile() const;
bool isDir() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment