mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
parent
b09e32ebc0
commit
25a0147f61
@ -315,18 +315,22 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
|
||||
// XXX: should we make sure HAVE_STRUCT_FSSTAT_F_FSTYPENAME is defined?
|
||||
return ((strncmp(buf.f_fstypename, "nfs", sizeof(buf.f_fstypename)) == 0)
|
||||
|| (strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)
|
||||
return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)
|
||||
|| (strncmp(buf.f_fstypename, "nfs", sizeof(buf.f_fstypename)) == 0)
|
||||
|| (strncmp(buf.f_fstypename, "smbfs", sizeof(buf.f_fstypename)) == 0));
|
||||
#else
|
||||
// usually defined in /usr/include/linux/magic.h
|
||||
const unsigned long CIFS_MAGIC_NUMBER = 0xFF534D42;
|
||||
const unsigned long NFS_SUPER_MAGIC = 0x6969;
|
||||
const unsigned long SMB_SUPER_MAGIC = 0x517B;
|
||||
|
||||
return ((buf.f_type == CIFS_MAGIC_NUMBER)
|
||||
|| (buf.f_type == NFS_SUPER_MAGIC)
|
||||
|| (buf.f_type == SMB_SUPER_MAGIC));
|
||||
// Magic number references:
|
||||
// 1. /usr/include/linux/magic.h
|
||||
// 2. https://github.com/coreutils/coreutils/blob/master/src/stat.c
|
||||
switch (buf.f_type) {
|
||||
case 0xFF534D42: // CIFS_MAGIC_NUMBER
|
||||
case 0x6969: // NFS_SUPER_MAGIC
|
||||
case 0x517B: // SMB_SUPER_MAGIC
|
||||
case 0xFE534D42: // S_MAGIC_SMB2
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user