From b31767bf27bafd3ae20ba3f26dd5001051b9f2b6 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze@samba.org>
Date: Thu, 28 Feb 2013 14:43:55 +0100
Subject: [PATCH] tevent: debug a FATAL message on EBADF from the select
 backend

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
---
 lib/tevent/tevent_select.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 24032631f8a..d8aeaa7c55c 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -157,6 +157,10 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
 	/* setup any fd events */
 	for (fde = select_ev->ev->fd_events; fde; fde = fde->next) {
 		if (fde->fd < 0 || fde->fd >= FD_SETSIZE) {
+			tevent_debug(select_ev->ev, TEVENT_DEBUG_FATAL,
+				     "ERROR: EBADF fd[%d] >= %d "
+				     "select_event_loop_once\n",
+				     fde->fd, FD_SETSIZE);
 			errno = EBADF;
 			return -1;
 		}