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>
master
Frediano Ziglio 2019-10-23 13:26:51 +01:00 committed by Laurent Vivier
parent 765e35d71f
commit 105e1023a8
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}