提交 a2214c52 编写于 作者: D Daniel P. Berrange

Fix iohelper usage with streams opened for read

In b2878ed8 we added the O_NOCTTY
flag when opening files in the stream code. Unfortunately a later
piece of code was comparing the flags == O_RDONLY, without masking
out the non-access mode flags. This broke the iohelper when used
with streams for read, since it caused us to attach the stream
output pipe to the stream input FD instead of output FD :-(
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 f493d83f
...@@ -641,7 +641,7 @@ virFDStreamOpenFileInternal(virStreamPtr st, ...@@ -641,7 +641,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
virCommandTransferFD(cmd, fd); virCommandTransferFD(cmd, fd);
virCommandAddArgFormat(cmd, "%d", fd); virCommandAddArgFormat(cmd, "%d", fd);
if (oflags == O_RDONLY) { if ((oflags & O_ACCMODE) == O_RDONLY) {
childfd = fds[1]; childfd = fds[1];
fd = fds[0]; fd = fds[0];
virCommandSetOutputFD(cmd, &childfd); virCommandSetOutputFD(cmd, &childfd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册