summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-02-14 10:29:49 -0500
committerSimo Sorce <idra@samba.org>2011-02-14 17:47:03 +0100
commitd6a41c2723cda59b3cd6ae9a1e77b62f25067663 (patch)
tree66a8e29182820eef1f44093976dce2af77ef3a17 /lib/tevent
parentb423d83729f3f096078fe49f7e46481b1b46679a (diff)
downloadsamba-d6a41c2723cda59b3cd6ae9a1e77b62f25067663.tar.gz
samba-d6a41c2723cda59b3cd6ae9a1e77b62f25067663.tar.bz2
samba-d6a41c2723cda59b3cd6ae9a1e77b62f25067663.zip
Return NULL if tevent_add_fd() is passed a negative fd
Autobuild-User: Simo Sorce <idra@samba.org> Autobuild-Date: Mon Feb 14 17:47:03 CET 2011 on sn-devel-104
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent_fd.c6
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;