aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/qtcprocess.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2020-02-18 15:33:15 -0800
committerOrgad Shaneh <orgads@gmail.com>2020-02-20 12:53:00 +0000
commit86fae567fa38097d0075dc8c145c48b11a9182fc (patch)
tree3e9fe9f914a8738d9d243a43dfd85f1c04765682 /src/libs/utils/qtcprocess.cpp
parent6f1ad0b0cbb2d8a3f7c487bfebdbb997bfc5c2bb (diff)
TerminalControllingProcess: don't use qWarning in the child process
qWarning() and all of QMessageLogger will get to qFormatLogMessage(), which locks a mutex. Additionally, qWarning may call a number of different backends that, in turn, may have mutexes of their own. Locking mutexes in child processes between fork() and execve() is a big no-no: it may have been locked by another thread before fork(), so it's still locked in the child process and will never get unlocked. Result: deadlock. Plus, qWarning reacts to QT_FATAL_WARNINGS, which I guess was not intended for this class. So just use a plain perror(), which is guaranteed by POSIX to be "MT-Safe race:stderr". Change-Id: I4e559af2a9a1455ab770fffd15f4a37a3fd113ca Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/libs/utils/qtcprocess.cpp')
-rw-r--r--src/libs/utils/qtcprocess.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 3b92f649975..2088ae408fc 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -39,6 +39,7 @@
#include <qt_windows.h>
#else
#include <errno.h>
+#include <stdio.h>
#include <unistd.h>
#endif
@@ -1226,7 +1227,7 @@ void QtcProcess::setupChildProcess()
if (m_lowPriority) {
errno = 0;
if (::nice(5) == -1 && errno != 0)
- qWarning("Failed to set nice value. Error: %d", errno);
+ perror("Failed to set nice value");
}
#endif
QProcess::setupChildProcess();