Commit d1224a63 authored by Michal Malý's avatar Michal Malý Committed by Elvis Angelaccio

Do not list an UDSEntry for a file or directory that was not stat()'ed successfully

Summary: Listing such an item seems like a bad thing to do.

Reviewers: elvisangelaccio

Reviewed By: elvisangelaccio

Differential Revision: https://phabricator.kde.org/D6663
parent 7d6a1576
......@@ -382,14 +382,19 @@ void SMBSlave::listDir( const QUrl& kurl )
// Set stat information
m_current_url.addPath(dirpName);
const int statErr = browse_stat_path(m_current_url, udsentry);
if (statErr == ENOENT || statErr == ENOTDIR)
if (statErr)
{
reportWarning(m_current_url, statErr);
if (statErr == ENOENT || statErr == ENOTDIR)
{
reportWarning(m_current_url, statErr);
}
}
else
{
// Call base class to list entry
listEntry(udsentry);
}
m_current_url.cd("..");
// Call base class to list entry
listEntry(udsentry);
}
else if(dirp->smbc_type == SMBC_SERVER ||
dirp->smbc_type == SMBC_FILE_SHARE)
......@@ -457,9 +462,15 @@ void SMBSlave::listDir( const QUrl& kurl )
{
udsentry.insert(KIO::UDSEntry::UDS_NAME, ".");
const int statErr = browse_stat_path(m_current_url, udsentry);
if (statErr == ENOENT || statErr == ENOTDIR)
if (statErr)
{
reportWarning(m_current_url, statErr);
if (statErr == ENOENT || statErr == ENOTDIR)
{
reportWarning(m_current_url, statErr);
}
// Create a default UDSEntry if we could not stat the actual directory
udsentry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
udsentry.insert(KIO::UDSEntry::UDS_ACCESS, (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
}
}
listEntry(udsentry);
......
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