Ticket #46608: qprocess-nozombies.patch

File qprocess-nozombies.patch, 819 bytes (added by RJVB (René Bertin), 6 years ago)
  • qprocess_unix.cpp

    old new  
    12961296    processManager()->remove(q);
    12971297}
    12981298
     1299//https://codereview.qt-project.org/#/c/61294/
    12991300bool QProcessPrivate::waitForDeadChild()
    13001301{
    13011302    Q_Q(QProcess);
    13021303
    13031304    // read a byte from the death pipe
    13041305    char c;
    1305     qt_safe_read(deathPipe[0], &c, 1);
     1306    qint64 readcount = qt_safe_read(deathPipe[0], &c, 1);
    13061307
    13071308    // check if our process is dead
    13081309    int exitStatus;
    1309     if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
     1310    if (qt_safe_waitpid(pid_t(pid), &exitStatus, readcount > 0 ? WNOHANG : 0) > 0) {
    13101311        processManager()->remove(q);
    13111312        crashed = !WIFEXITED(exitStatus);
    13121313        exitCode = WEXITSTATUS(exitStatus);