From ecc54f900fa6aaf1b97ef85b1101cf7badf33cec Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 May 2007 00:57:48 +0000 Subject: r22830: merged the latest lib/events updates from ctdb to Samba4. This includes a new EVENT_FD_AUTOCLOSE flag that prevents race conditions where code using fd events might close a fd before releasing the struct fd_event. That causes headaches for epoll. (This used to be commit f1ad216de13b154a1f8747a44b0970dcc47a784a) --- source4/lib/events/events_liboop.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/events/events_liboop.c') diff --git a/source4/lib/events/events_liboop.c b/source4/lib/events/events_liboop.c index 96bdafd956..cc9047b4eb 100644 --- a/source4/lib/events/events_liboop.c +++ b/source4/lib/events/events_liboop.c @@ -101,6 +101,11 @@ static int oop_event_fd_destructor(struct fd_event *fde) if (fde->flags & EVENT_FD_WRITE) oop->cancel_fd(oop, fde->fd, OOP_WRITE); + if (fde->flags & EVENT_FD_AUTOCLOSE) { + close(fde->fd); + fde->fd = -1; + } + return 0; } -- cgit