diff options
Diffstat (limited to 'lib/tevent')
-rw-r--r-- | lib/tevent/tevent_fd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/tevent/tevent_fd.c b/lib/tevent/tevent_fd.c index c58e8e1ab1..455961b67c 100644 --- a/lib/tevent/tevent_fd.c +++ b/lib/tevent/tevent_fd.c @@ -51,6 +51,12 @@ struct tevent_fd *tevent_common_add_fd(struct tevent_context *ev, TALLOC_CTX *me { struct tevent_fd *fde; + /* tevent will crash later on select() if we save + * a negative file descriptor. Better to fail here + * so that consumers will be able to debug it + */ + if (fd < 0) return NULL; + fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd); if (!fde) return NULL; |