summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrediano Ziglio2019-10-23 14:26:51 +0200
committerLaurent Vivier2019-10-24 19:26:52 +0200
commit105e1023a855dd13fc15a8253fe6476f443e48aa (patch)
tree681765e17ec54ddde989b32dead552413b1820ad
parentutil/async: avoid useless cast (diff)
downloadqemu-105e1023a855dd13fc15a8253fe6476f443e48aa.tar.gz
qemu-105e1023a855dd13fc15a8253fe6476f443e48aa.tar.xz
qemu-105e1023a855dd13fc15a8253fe6476f443e48aa.zip
event_notifier: avoid dandling file descriptor in event_notifier_cleanup
If rfd is equal to wfd the file descriptor is closed but rfd will still have the closed value. The EventNotifier structure should not be used again after calling event_notifier_cleanup or should be initialized again but make sure to not have dandling file descriptors around. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191023122652.2999-2-fziglio@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r--util/event_notifier-posix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
index 73c4046b58..00d93204f9 100644
--- a/util/event_notifier-posix.c
+++ b/util/event_notifier-posix.c
@@ -80,8 +80,8 @@ void event_notifier_cleanup(EventNotifier *e)
{
if (e->rfd != e->wfd) {
close(e->rfd);
- e->rfd = -1;
}
+ e->rfd = -1;
close(e->wfd);
e->wfd = -1;
}