summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-26 00:37:14 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-01-26 00:37:14 +0000
commit398a7e736cb42ac42f0887989585b1121b7e6e62 (patch)
tree916854b706b9b057fa1483f76dd48998a8aa28a0 /src/corelib/io
parent4d3a35f63788fa5ff7a11a5bb7bd6176bd2ac70e (diff)
parent318b58562ae89453fb98e8145cd0440e14ba60b0 (diff)
Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qlockfile.cpp3
-rw-r--r--src/corelib/io/qlockfile_unix.cpp13
-rw-r--r--src/corelib/io/qprocess.cpp3
-rw-r--r--src/corelib/io/qurl.cpp2
4 files changed, 9 insertions, 12 deletions
diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp
index ae3a7c6abc..cb1ff93ad3 100644
--- a/src/corelib/io/qlockfile.cpp
+++ b/src/corelib/io/qlockfile.cpp
@@ -84,6 +84,9 @@ QT_BEGIN_NAMESPACE
For the use case of protecting a resource over a long time, you should therefore call
setStaleLockTime(0), and when tryLock() returns LockFailedError, inform the user
that the document is locked, possibly using getLockInfo() for more details.
+
+ \note On Windows, this class has problems detecting a stale lock if the
+ machine's hostname contains characters outside the US-ASCII character set.
*/
/*!
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 82beb15912..3a80014c00 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -81,15 +81,6 @@
QT_BEGIN_NAMESPACE
-static QByteArray localHostName() // from QHostInfo::localHostName(), modified to return a QByteArray
-{
- QByteArray hostName(512, Qt::Uninitialized);
- if (gethostname(hostName.data(), hostName.size()) == -1)
- return QByteArray();
- hostName.truncate(strlen(hostName.data()));
- return hostName;
-}
-
// ### merge into qt_safe_write?
static qint64 qt_write_loop(int fd, const char *data, qint64 len)
{
@@ -185,7 +176,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
// Use operator% from the fast builder to avoid multiple memory allocations.
QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'
% QCoreApplication::applicationName().toUtf8() % '\n'
- % localHostName() % '\n';
+ % QSysInfo::machineHostName().toUtf8() % '\n';
const QByteArray lockFileName = QFile::encodeName(fileName);
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
@@ -242,7 +233,7 @@ bool QLockFilePrivate::isApparentlyStale() const
qint64 pid;
QString hostname, appname;
if (getLockInfo(&pid, &hostname, &appname)) {
- if (hostname.isEmpty() || hostname == QString::fromLocal8Bit(localHostName())) {
+ if (hostname.isEmpty() || hostname == QSysInfo::machineHostName()) {
if (::kill(pid, 0) == -1 && errno == ESRCH)
return true; // PID doesn't exist anymore
const QString processName = processNameByPid(pid);
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index f2c2ba4476..c27484acbe 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -513,6 +513,9 @@ void QProcessPrivate::Channel::clear()
You can also call error() to find the type of error that occurred
last, and state() to find the current process state.
+ \note QProcess is not supported on VxWorks, iOS, tvOS, watchOS,
+ or the Universal Windows Platform.
+
\section1 Communicating via Channels
Processes have two predefined output channels: The standard
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index c224b032aa..a6372b75f6 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -240,7 +240,7 @@
Only valid if RemovePath is not set.
\value PreferLocalFile If the URL is a local file according to isLocalFile()
and contains no query or fragment, a local file path is returned.
- \value StripTrailingSlash The trailing slash is removed if one is present.
+ \value StripTrailingSlash The trailing slash is removed from the path, if one is present.
\value NormalizePathSegments Modifies the path to remove redundant directory separators,
and to resolve "."s and ".."s (as far as possible).