QProcess/Unix: don't set the SIGPIPE signal handler twice
If the user is asking us to ignore it, don't set to the default behavior. Change-Id: Ib5ce7a497e034ebabb2cfffd17628562f745358d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
52ed6af527
commit
bf67518b53
@ -799,8 +799,6 @@ static void callChildProcessModifier(const QProcessPrivate *d) noexcept
|
|||||||
// still sharing memory with the parent process.
|
// still sharing memory with the parent process.
|
||||||
void QChildProcess::startProcess() const noexcept
|
void QChildProcess::startProcess() const noexcept
|
||||||
{
|
{
|
||||||
QtVforkSafe::change_sigpipe(SIG_DFL); // reset the signal that we ignored
|
|
||||||
|
|
||||||
// Render channels configuration.
|
// Render channels configuration.
|
||||||
d->commitChannels();
|
d->commitChannels();
|
||||||
|
|
||||||
@ -811,6 +809,7 @@ void QChildProcess::startProcess() const noexcept
|
|||||||
if (workingDirectory >= 0 && fchdir(workingDirectory) == -1)
|
if (workingDirectory >= 0 && fchdir(workingDirectory) == -1)
|
||||||
failChildProcess(d, "fchdir", errno);
|
failChildProcess(d, "fchdir", errno);
|
||||||
|
|
||||||
|
bool sigpipeHandled = false;
|
||||||
if (d->unixExtras) {
|
if (d->unixExtras) {
|
||||||
// FIRST we call the user modifier function, before we dropping
|
// FIRST we call the user modifier function, before we dropping
|
||||||
// privileges or closing non-standard file descriptors
|
// privileges or closing non-standard file descriptors
|
||||||
@ -818,6 +817,13 @@ void QChildProcess::startProcess() const noexcept
|
|||||||
|
|
||||||
// then we apply our other user-provided parameters
|
// then we apply our other user-provided parameters
|
||||||
applyProcessParameters(d->unixExtras->processParameters);
|
applyProcessParameters(d->unixExtras->processParameters);
|
||||||
|
|
||||||
|
auto flags = d->unixExtras->processParameters.flags;
|
||||||
|
sigpipeHandled = flags.testAnyFlags(QProcess::ResetSignalHandlers | QProcess::IgnoreSigPipe);
|
||||||
|
}
|
||||||
|
if (!sigpipeHandled) {
|
||||||
|
// reset the signal that we ignored
|
||||||
|
QtVforkSafe::change_sigpipe(SIG_DFL); // reset the signal that we ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute the process
|
// execute the process
|
||||||
|
Loading…
x
Reference in New Issue
Block a user