From patchwork Thu Mar 20 18:25:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Bizon X-Patchwork-Id: 332351 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0742F2C00A1 for ; Fri, 21 Mar 2014 05:25:49 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D1CA29D2B4; Thu, 20 Mar 2014 14:25:46 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tjGcZkSkuGmw; Thu, 20 Mar 2014 14:25:46 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 93DC99D2BD; Thu, 20 Mar 2014 14:25:41 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 45EEA9D2BB for ; Thu, 20 Mar 2014 14:25:40 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TRPOOVhjfeii for ; Thu, 20 Mar 2014 14:25:34 -0400 (EDT) Received: from ns.iliad.fr (ns.iliad.fr [212.27.33.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id B7E3C9D2BD for ; Thu, 20 Mar 2014 14:25:25 -0400 (EDT) Received: from ns.iliad.fr (localhost [127.0.0.1]) by ns.iliad.fr (Postfix) with ESMTP id E8C021FFFE; Thu, 20 Mar 2014 19:25:24 +0100 (CET) Received: from sakura.iliad.local (freebox.vlq16.iliad.fr [213.36.7.13]) by ns.iliad.fr (Postfix) with ESMTP id D54BD1FFF1; Thu, 20 Mar 2014 19:25:24 +0100 (CET) From: Maxime Bizon To: hostap@lists.shmoo.com Subject: [PATCH] eloop: add assert() on negative fd when using select() code path Date: Thu, 20 Mar 2014 19:25:18 +0100 Message-Id: <1395339918-4632-1-git-send-email-mbizon@freebox.fr> X-Mailer: git-send-email 1.7.9.5 X-Virus-Scanned: ClamAV using ClamSMTP ; ns.iliad.fr ; Thu Mar 20 19:25:24 2014 +0100 (CET) X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Signed-off-by: Maxime Bizon --- src/utils/eloop.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/eloop.c b/src/utils/eloop.c index f83a232..e304c67 100644 --- a/src/utils/eloop.c +++ b/src/utils/eloop.c @@ -13,8 +13,9 @@ #include "list.h" #include "eloop.h" -#ifdef CONFIG_ELOOP_POLL #include + +#ifdef CONFIG_ELOOP_POLL #include #endif /* CONFIG_ELOOP_POLL */ @@ -374,8 +375,10 @@ static void eloop_sock_table_set_fds(struct eloop_sock_table *table, if (table->table == NULL) return; - for (i = 0; i < table->count; i++) + for (i = 0; i < table->count; i++) { + assert(table->table[i].sock >= 0); FD_SET(table->table[i].sock, fds); + } }