From b525ec2eb0bb441ac0dcd0a055efcad08fe6957c Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 17 Aug 2017 09:31:19 +0300 Subject: Android: Fix compile with unified headers Unified headers now defines _POSIX_THREAD_SAFE_FUNCTIONS but not all libc functions are available in all Android API versions. Change-Id: I01c94f0b89e7f8aa8575e7bbda28d9fe41a68ff1 Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemengine_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/io/qfilesystemengine_unix.cpp') diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 6640e2b7e7..ac0c43d055 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -398,7 +398,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId) #if !defined(Q_OS_INTEGRITY) struct group *gr = 0; -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24)) size_max = sysconf(_SC_GETGR_R_SIZE_MAX); if (size_max == -1) size_max = 1024; -- cgit v1.2.3 From 0f11fab6f75dec78d3721280971448cc2edd6e72 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 26 Aug 2017 23:02:07 +0300 Subject: Fix resolution of relative symlinks from relative path on unix Consider the following: /root/target - a file /root/path/link -> ../target /root/path/other/exe - executable Running from /root/path/other. exe is: #include #include int main() { qDebug() << QFileInfo("../link").symLinkTarget() return 0; } The link references /root/target, but the current output is /root/path/target. The link doesn't depend on the PWD. It depends on its own directory. Change-Id: I61e95018154a75e0e0d795ee801068e18870a5df Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemengine_unix.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/corelib/io/qfilesystemengine_unix.cpp') diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index ac0c43d055..7600c9a613 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -187,13 +187,11 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, #endif if (!ret.startsWith(QLatin1Char('/'))) { - const QString linkFilePath = link.filePath(); - if (linkFilePath.startsWith(QLatin1Char('/'))) { - ret.prepend(linkFilePath.leftRef(linkFilePath.lastIndexOf(QLatin1Char('/'))) - + QLatin1Char('/')); - } else { - ret.prepend(QDir::currentPath() + QLatin1Char('/')); - } + const QString linkPath = link.path(); + if (linkPath.startsWith(QLatin1Char('/'))) + ret.prepend(linkPath + QLatin1Char('/')); + else + ret.prepend(QDir::currentPath() + QLatin1Char('/') + linkPath + QLatin1Char('/')); } ret = QDir::cleanPath(ret); if (ret.size() > 1 && ret.endsWith(QLatin1Char('/'))) -- cgit v1.2.3