Skip to content

Commit

Permalink
Don't use deprecated statfs64() on macOS (qbittorrent#15661)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Korotysh <kolchaprogrammer@list.ru>
Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
  • Loading branch information
Chocobo1 and Kolcha committed Nov 2, 2021
1 parent 5dd70b8 commit 7aa859a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions cmake/Modules/MacroQbtCommonConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ macro(qbt_common_config)
$<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG_OUTPUT>
)

if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_compile_definitions(qbt_common_cfg INTERFACE
_DARWIN_FEATURE_64_BIT_INODE
)
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(qbt_common_cfg INTERFACE
NTDDI_VERSION=0x06010000
Expand Down
2 changes: 2 additions & 0 deletions macxconf.pri
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ else {

QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14

DEFINES += _DARWIN_FEATURE_64_BIT_INODE

LIBS += -framework Carbon -framework IOKit -framework AppKit

QT_LANG_PATH = ../dist/qt-translations
Expand Down
6 changes: 0 additions & 6 deletions src/base/utils/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,9 @@ bool Utils::Fs::isNetworkFileSystem(const QString &path)
file += '/';
file += '.';

#if defined(Q_OS_MACOS)
struct statfs64 buf {};
if (statfs64(file.toLocal8Bit().constData(), &buf) != 0)
return false;
#else
struct statfs buf {};
if (statfs(file.toLocal8Bit().constData(), &buf) != 0)
return false;
#endif

#if defined(Q_OS_OPENBSD)
return ((strncmp(buf.f_fstypename, "cifs", sizeof(buf.f_fstypename)) == 0)
Expand Down

0 comments on commit 7aa859a

Please sign in to comment.