qemu_eventfd() returns two file descriptors, both of which
must be closed when pipe() is used in the absence of eventfd().
Duplicate the eventfd() file descriptor so that closing
both descriptors will work in that case.
Signed-off-by: Mark McLoughlin <[EMAIL PROTECTED]>
---
qemu/compatfd.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/qemu/compatfd.c b/qemu/compatfd.c
index cc5ced3..36e37e5 100644
--- a/qemu/compatfd.c
+++ b/qemu/compatfd.c
@@ -118,7 +118,11 @@ int qemu_eventfd(int *fds)
ret = syscall(SYS_eventfd, 0);
if (ret >= 0) {
- fds[0] = fds[1] = ret;
+ fds[0] = ret;
+ if ((fds[1] = dup(ret)) == -1) {
+ close(ret);
+ return -1;
+ }
return 0;
}
#endif
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html