[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] event_notifier: avoid dandling file descriptor in event_noti
From: |
Frediano Ziglio |
Subject: |
[PATCH 2/3] event_notifier: avoid dandling file descriptor in event_notifier_cleanup |
Date: |
Wed, 23 Oct 2019 13:26:51 +0100 |
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 <address@hidden>
---
util/event_notifier-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
2.21.0
- [PATCH 1/3] util/async: avoid useless cast, Frediano Ziglio, 2019/10/23
- [PATCH 2/3] event_notifier: avoid dandling file descriptor in event_notifier_cleanup,
Frediano Ziglio <=
- [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Frediano Ziglio, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Laurent Vivier, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Eric Blake, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Frediano Ziglio, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Eric Blake, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Laurent Vivier, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Eric Blake, 2019/10/23
- Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms, Laurent Vivier, 2019/10/23