summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal MalĂ˝ <[email protected]>2017-07-18 18:08:20 +0200
committerElvis Angelaccio <[email protected]>2017-07-18 18:11:20 +0200
commitd1224a63514f66f96fea8de2c07b03d540737b6f (patch)
tree2c2efd3cfcdf0156cbe40f8d12b547ad75f7615f
parent7d6a1576d645d5439de0f5c879baa6143a00632a (diff)
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
-rw-r--r--smb/kio_smb_browse.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/smb/kio_smb_browse.cpp b/smb/kio_smb_browse.cpp
index d380c0d..3c1d64c 100644
--- a/smb/kio_smb_browse.cpp
+++ b/smb/kio_smb_browse.cpp
@@ -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);