1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-30 06:50:24 +03:00

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
This commit is contained in:
Stephen Gallagher 2011-02-14 10:29:49 -05:00 committed by Simo Sorce
parent b423d83729
commit d6a41c2723

View File

@ -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;