diff options
Diffstat (limited to 'src/corelib/io/qlockfile_unix.cpp')
-rw-r--r-- | src/corelib/io/qlockfile_unix.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index ccc607afd5..1ee8ce889c 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -199,7 +199,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() } if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) { - close(fd); + qt_safe_close(fd); if (!QFile::remove(fileName)) qWarning("QLockFile: Could not remove our own lock file %s.", qPrintable(fileName)); return QLockFile::UnknownError; // partition full @@ -258,17 +258,17 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) proc_name(pid, name, sizeof(name) / sizeof(char)); return QFile::decodeName(name); #elif defined(Q_OS_LINUX) - if (!QFile::exists(QStringLiteral("/proc/version"))) + if (!qt_haveLinuxProcfs()) return QString(); + char exePath[64]; - char buf[PATH_MAX + 1]; sprintf(exePath, "/proc/%lld/exe", pid); - size_t len = (size_t)readlink(exePath, buf, sizeof(buf)); - if (len >= sizeof(buf)) { + + QByteArray buf = qt_readlink(exePath); + if (buf.isEmpty()) { // The pid is gone. Return some invalid process name to fail the test. return QStringLiteral("/ERROR/"); } - buf[len] = 0; return QFileInfo(QFile::decodeName(buf)).fileName(); #elif defined(Q_OS_HAIKU) thread_info info; |