ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #05188
[Merge] lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05 into lp:ubuntu-filemanager-app
Carlos Jose Mazieri has proposed merging lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05 into lp:ubuntu-filemanager-app with lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-04 as a prerequisite.
Commit message:
changed SmbUtil::getStat() and SmbUtil::getFstat() to return int as they do not handle items from SmbUtil::StatReturn, they are just a wrapper to libsmbclient stat functions, is SmbUtil::getStatInfo() which does handle SmbUtil::StatReturn
Requested reviews:
Ubuntu File Manager Developers (ubuntu-filemanager-dev)
For more details, see:
https://code.launchpad.net/~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05/+merge/273514
changed SmbUtil::getStat() and SmbUtil::getFstat() to return int as they do not handle items from SmbUtil::StatReturn, they are just a wrapper to libsmbclient stat functions, is SmbUtil::getStatInfo() which does handle SmbUtil::StatReturn
--
Your team Ubuntu File Manager Developers is requested to review the proposed merge of lp:~carlos-mazieri/ubuntu-filemanager-app/samba-improvements-05 into lp:ubuntu-filemanager-app.
=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp 2015-08-15 18:38:28 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smblocationitemfile.cpp 2015-10-06 10:52:01 +0000
@@ -232,13 +232,16 @@
SmbUtil::StatReturn ret = SmbUtil::StatInvalid;
if (isOpen())
{
- ret = smbObj()->getFstat(m_context,m_fd, &st);
+ ret = static_cast<SmbUtil::StatReturn> (smbObj()->getFstat(m_context,m_fd,&st));
}
else
{
- SmbLocationItemFile *mySelf = const_cast<SmbLocationItemFile*> (this);
- mySelf->createContext();
- ret = smbObj()->getStat(m_context,cleanUrl(), &st);
+ if (m_context != 0) {
+ ret = static_cast<SmbUtil::StatReturn> (smbObj()->getStat(m_context,cleanUrl(),&st));
+ }
+ else {
+ ret = smbObj()->getStatInfo(cleanUrl(),&st);
+ }
}
if(ret == SmbUtil::StatDone)
{
=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp 2015-10-06 10:52:01 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.cpp 2015-10-06 10:52:01 +0000
@@ -38,11 +38,17 @@
#if defined(SHOW_MESSAGES)
# define DBG(more_items) qDebug() << Q_FUNC_INFO more_items
+# define DBG_STAT(ret) qDebug() << Q_FUNC_INFO \
+ << "return:" << ret \
+ << "mode:" << st->st_mode \
+ << "mtime:" << st->st_mtime \
+ << "size:" << st->st_size
#else
#define DBG(none)
+#define DBG_STAT(ret)
#endif
-#define SHOW_ERRNO(path) if (errno != 0 && errno != ENOENT) \
+#define SHOW_ERRNO(path) if (errno != 0) \
{ \
qWarning() << Q_FUNC_INFO << "path:" << path << "errno:" << errno << strerror(errno); \
}
@@ -342,7 +348,7 @@
Smb::FileHandler fd = 0;
::memset(st, 0, sizeof(struct stat));
if ((fd=openDir(context, smb_path)) )
- {
+ {
ret = guessDirType(context,fd);
closeHandle(context, fd);
if (ret == StatDir)
@@ -356,9 +362,9 @@
}
}
else if (errno != EACCES && errno != ECONNREFUSED) // perhaps is a file
- {
+ {
errno = 0;
- ret = getStat(context, smb_path,st);
+ ret = static_cast<SmbUtil::StatReturn> (getStat(context, smb_path,st));
}
if (errno != 0)
@@ -636,6 +642,10 @@
{
return false;
}
+ if (::strcmp(shareName, "ADMIN$") == 0)
+ {
+ return false;
+ }
return true;
}
@@ -727,7 +737,7 @@
bool SmbUtil::changePermissions(Smb::Context context, const QString& smb_path, mode_t mode)
{
- int ret = ::smbc_getFunctionChmod(context)(context, smb_path.toLocal8Bit().constBegin(), mode);
+ int ret = ::smbc_getFunctionChmod(context)(context, smb_path.toLocal8Bit().constData(), mode);
if (ret < 0)
{
SHOW_ERRNO(smb_path);
@@ -736,19 +746,22 @@
}
-SmbUtil::StatReturn
+int
SmbUtil::getFstat(Smb::Context context, Smb::FileHandler fd, struct stat* st)
{
::memset(st,0,sizeof(struct stat));
int ret = ::smbc_getFunctionFstat(context)(context,fd, st);
- return static_cast<SmbUtil::StatReturn> (ret);
+ DBG_STAT(ret);
+ return ret;
}
-SmbUtil::StatReturn
+int
SmbUtil::getStat(Smb::Context context, const QString& smb_path, struct stat* st)
{
::memset(st,0,sizeof(struct stat));
+ DBG(<< smb_path);
int ret = ::smbc_getFunctionStat(context)(context,smb_path.toLocal8Bit().constData(), st);
- return static_cast<SmbUtil::StatReturn> (ret);
+ DBG_STAT(ret);
+ return ret;
}
=== modified file 'src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h'
--- src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h 2015-07-15 13:00:56 +0000
+++ src/plugin/folderlistmodel/smb/qsambaclient/src/smbutil.h 2015-10-06 10:52:01 +0000
@@ -94,8 +94,8 @@
bool recursive = false,
QDir::Filters filters = QDir::AllEntries | QDir::NoDotAndDotDot,
const QStringList& filterNames = QStringList());
- StatReturn getFstat(Smb::Context context, Smb::FileHandler fd, struct stat* st);
- StatReturn getStat(Smb::Context context, const QString& smb_path, struct stat* st);
+ int getFstat(Smb::Context context, Smb::FileHandler fd, struct stat* st);
+ int getStat(Smb::Context context, const QString& smb_path, struct stat* st);
private:
StatReturn guessDirType(Smb::Context context, Smb::FileHandler fd);