summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qprocess_unix.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 9cd3bd531b..2186f23ab6 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -451,8 +451,13 @@ void QProcessPrivate::startProcess()
}
// Start the process manager, and fork off the child process.
+ // ### Qt6: revisit whether the change in behavior due to not using fork()
+ // is acceptable for derived classes.
+ int ffdflags = FFD_CLOEXEC;
+ if (typeid(*q) != typeid(QProcess))
+ ffdflags |= FFD_USE_FORK;
pid_t childPid;
- forkfd = ::forkfd(FFD_CLOEXEC, &childPid);
+ forkfd = ::forkfd(ffdflags , &childPid);
int lastForkErrno = errno;
if (forkfd != FFD_CHILD_PROCESS) {
// Parent process.