qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

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>

authored by

Frediano Ziglio and committed by
Laurent Vivier
105e1023 765e35d7

+1 -1
+1 -1
util/event_notifier-posix.c
··· 80 80 { 81 81 if (e->rfd != e->wfd) { 82 82 close(e->rfd); 83 - e->rfd = -1; 84 83 } 84 + e->rfd = -1; 85 85 close(e->wfd); 86 86 e->wfd = -1; 87 87 }