Ticket #46496: qprocess-nozombies.patch

File qprocess-nozombies.patch, 833 bytes (added by RJVB (René Bertin), 10 years ago)

prevent zombie processes

  • qtbase/src/corelib/io/

    old new  
    13201320    processManager()->remove(q);
    13211321}
    13221322
     1323//https://codereview.qt-project.org/#/c/61294/
    13231324bool QProcessPrivate::waitForDeadChild()
    13241325{
    13251326    Q_Q(QProcess);
    13261327
    13271328    // read a byte from the death pipe
    13281329    char c;
    1329     qt_safe_read(deathPipe[0], &c, 1);
     1330    qint64 readcount = qt_safe_read(deathPipe[0], &c, 1);
    13301331
    13311332    // check if our process is dead
    13321333    int exitStatus;
    1333     if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
     1334    if (qt_safe_waitpid(pid_t(pid), &exitStatus, readcount > 0 ? WNOHANG : 0) > 0) {
    13341335        processManager()->remove(q);
    13351336        crashed = !WIFEXITED(exitStatus);
    13361337        exitCode = WEXITSTATUS(exitStatus);