Skip to content

Commit

Permalink
event_notifier: avoid dandling file descriptor in event_notifier_cleanup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Frediano Ziglio authored and vivier committed Oct 24, 2019
1 parent 765e35d commit 105e102
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/event_notifier-posix.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 105e102

Please sign in to comment.