diff options
author | Liang Qi <liang.qi@qt.io> | 2017-08-31 13:10:18 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-08-31 14:31:31 +0200 |
commit | 112a4af10741409b3d8503cb77852a777b607ce0 (patch) | |
tree | fa99f0f37fc1505522fe9368e95484c7732ccda8 /src/corelib/io | |
parent | 29ef0d2bccd1874e20de94485ee05777c3a95c5d (diff) | |
parent | e938150412d22e61926fe16791158805b71268bb (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
examples/examples.pro
qmake/library/qmakebuiltins.cpp
src/corelib/global/qglobal.cpp
Re-apply b525ec2 to qrandom.cpp(code movement in 030782e)
src/corelib/global/qnamespace.qdoc
src/corelib/global/qrandom.cpp
src/gui/kernel/qwindow.cpp
Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08)
src/network/ssl/qsslkey_openssl.cpp
src/plugins/platforms/android/androidjniinput.cpp
src/plugins/platforms/xcb/qxcbconnection.cpp
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
src/widgets/widgets/qmenu.cpp
tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfileinfo.cpp | 22 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 14 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemwatcher_inotify.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qprocess.cpp | 10 | ||||
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 12 |
5 files changed, 46 insertions, 22 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 235e391aa0..26078a6c71 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -870,12 +870,12 @@ QString QFileInfo::suffix() const \b{Note:} The QDir returned always corresponds to the object's parent directory, even if the QFileInfo represents a directory. - For each of the following, dir() returns a QDir for + For each of the following, dir() returns the QDir \c{"~/examples/191697"}. \snippet fileinfo/main.cpp 0 - For each of the following, dir() returns a QDir for + For each of the following, dir() returns the QDir \c{"."}. \snippet fileinfo/main.cpp 1 @@ -1034,12 +1034,16 @@ bool QFileInfo::isBundle() const } /*! - Returns \c true if this object points to a symbolic link (or to a - shortcut on Windows); otherwise returns \c false. + Returns \c true if this object points to a symbolic link; + otherwise returns \c false. - On Unix (including \macos and iOS), opening a symlink effectively opens - the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c - .lnk file itself. + Symbolic links exist on Unix (including \macos and iOS) and Windows + and are typically created by the \c{ln -s} or \c{mklink} commands, + respectively. Opening a symbolic link effectively opens + the \l{symLinkTarget()}{link's target}. + + In addition, true will be returned for shortcuts (\c *.lnk files) on + Windows. Opening those will open the \c .lnk file itself. Example: @@ -1090,8 +1094,8 @@ bool QFileInfo::isRoot() const \fn QString QFileInfo::symLinkTarget() const \since 4.2 - Returns the absolute path to the file or directory a symlink (or shortcut - on Windows) points to, or a an empty string if the object isn't a symbolic + Returns the absolute path to the file or directory a symbolic link + points to, or an empty string if the object isn't a symbolic link. This name may not represent an existing file; it is only a string. diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 3f2bc04b9c..2828c85048 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -635,13 +635,11 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link, ret += QFile::decodeName(s); 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('/'))) @@ -853,7 +851,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; diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 3cfc6a254f..048669b92f 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -222,6 +222,14 @@ QT_END_NAMESPACE #include <sys/inotify.h> +// see https://github.com/android-ndk/ndk/issues/394 +# if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21) +static inline int inotify_init1(int flags) +{ + return syscall(__NR_inotify_init1, flags); +} +# endif + #endif QT_BEGIN_NAMESPACE @@ -229,7 +237,7 @@ QT_BEGIN_NAMESPACE QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent) { int fd = -1; -#ifdef IN_CLOEXEC +#if defined(IN_CLOEXEC) fd = inotify_init1(IN_CLOEXEC); #endif if (fd == -1) { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 1bb3362d5e..7ed319f5f1 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1024,7 +1024,8 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel) if (readBytes == -1) { setErrorAndEmit(QProcess::ReadError); #if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process", channel - &stdinChannel); + qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process", + int(channel - &stdinChannel)); #endif return false; } @@ -1034,13 +1035,14 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel) channel->notifier->setEnabled(false); closeChannel(channel); #if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", channel - &stdinChannel); + qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", + int(channel - &stdinChannel)); #endif return false; } #if defined QPROCESS_DEBUG - qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output", channel - &stdinChannel - int(readBytes)); + qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output", + int(channel - &stdinChannel), int(readBytes)); #endif if (channel->closed) { diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index cf9d38097a..15752f84b2 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -762,6 +762,10 @@ bool QProcessPrivate::waitForReadyRead(int msecs) if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) _q_canWrite(); + // Signals triggered by I/O may have stopped this process: + if (processState == QProcess::NotRunning) + return false; + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return false; @@ -808,6 +812,10 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) _q_canReadStandardError(); + // Signals triggered by I/O may have stopped this process: + if (processState == QProcess::NotRunning) + return false; + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return false; @@ -853,6 +861,10 @@ bool QProcessPrivate::waitForFinished(int msecs) if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) _q_canReadStandardError(); + // Signals triggered by I/O may have stopped this process: + if (processState == QProcess::NotRunning) + return true; + if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (_q_processDied()) return true; |