Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file_unix.cpp
Show First 20 Lines • Show All 412 Lines • ▼ Show 20 Line(s) | 398 | { | |||
---|---|---|---|---|---|
413 | return (QString::compare(url.host(), QLatin1String(hostname), Qt::CaseInsensitive) == 0); | 413 | return (QString::compare(url.host(), QLatin1String(hostname), Qt::CaseInsensitive) == 0); | ||
414 | } | 414 | } | ||
415 | 415 | | |||
416 | #if HAVE_SYS_XATTR_H | 416 | #if HAVE_SYS_XATTR_H | ||
417 | static bool isNtfsHidden(const QString &filename) | 417 | static bool isNtfsHidden(const QString &filename) | ||
418 | { | 418 | { | ||
419 | constexpr auto attrName = "system.ntfs_attrib_be"; | 419 | constexpr auto attrName = "system.ntfs_attrib_be"; | ||
420 | const auto filenameEncoded = QFile::encodeName(filename); | 420 | const auto filenameEncoded = QFile::encodeName(filename); | ||
421 | #ifdef Q_OS_MACOS | ||||
422 | auto length = getxattr(filenameEncoded.data(), attrName, nullptr, 0, 0, XATTR_NOFOLLOW); | ||||
423 | #else | ||||
421 | auto length = getxattr(filenameEncoded.data(), attrName, nullptr, 0); | 424 | auto length = getxattr(filenameEncoded.data(), attrName, nullptr, 0); | ||
425 | #endif | ||||
422 | if (length <= 0) { | 426 | if (length <= 0) { | ||
423 | return false; | 427 | return false; | ||
424 | } | 428 | } | ||
425 | constexpr size_t xattr_size = 1024; | 429 | constexpr size_t xattr_size = 1024; | ||
426 | char strAttr[xattr_size]; | 430 | char strAttr[xattr_size]; | ||
431 | #ifdef Q_OS_MACOS | ||||
432 | length = getxattr(filenameEncoded.data(), attrName, strAttr, xattr_size, 0, XATTR_NOFOLLOW); | ||||
433 | #else | ||||
427 | length = getxattr(filenameEncoded.data(), attrName, strAttr, xattr_size); | 434 | length = getxattr(filenameEncoded.data(), attrName, strAttr, xattr_size); | ||
435 | #endif | ||||
428 | if (length <= 0) { | 436 | if (length <= 0) { | ||
429 | return false; | 437 | return false; | ||
430 | } | 438 | } | ||
431 | 439 | | |||
432 | // Decode result to hex string | 440 | // Decode result to hex string | ||
433 | static constexpr auto digits = "0123456789abcdef"; | 441 | static constexpr auto digits = "0123456789abcdef"; | ||
434 | QVarLengthArray<char> hexAttr(static_cast<int>(length) * 2 + 4); | 442 | QVarLengthArray<char> hexAttr(static_cast<int>(length) * 2 + 4); | ||
435 | char *c = strAttr; | 443 | char *c = strAttr; | ||
▲ Show 20 Lines • Show All 430 Lines • Show Last 20 Lines |