提交 b5a210dc 编写于 作者: R Roman Bogorodskiy 提交者: Cole Robinson

vircommand: fix polling in virCommandProcessIO

When running on FreeBSD, there's a bug in virCommandProcessIO
polling that is triggered by the commandtest.

A test that triggers EPIPE in commandtest (named "test20") hungs
forever on FreeBSD.

Apparently, this happens because FreeBSD sets POLLHUP flag on revents
when stdin in closed. And as the current implementation only checks for
POLLOUT and POLLERR, it ends up looping forever inside
virCommandProcessIO and not trying to do one more write() that would
trigger EPIPE.

To fix that check for the POLLHUP flag along with POLLOUT and POLLERR.

(cherry picked from commit e34cccf7)
上级 e84e5aa3
......@@ -2073,7 +2073,7 @@ virCommandProcessIO(virCommandPtr cmd)
}
}
if (fds[i].revents & (POLLOUT | POLLERR) &&
if (fds[i].revents & (POLLOUT | POLLHUP | POLLERR) &&
fds[i].fd == cmd->inpipe) {
int done;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册