diff --git a/src/fdstream.c b/src/fdstream.c index 53dde97ccb..625842d27c 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -640,7 +640,7 @@ virFDStreamOpenFileInternal(virStreamPtr st, virCommandTransferFD(cmd, fd); virCommandAddArgFormat(cmd, "%d", fd); - if (oflags == O_RDONLY) { + if ((oflags & O_ACCMODE) == O_RDONLY) { childfd = fds[1]; fd = fds[0]; virCommandSetOutputFD(cmd, &childfd);