From owner-p4-projects@FreeBSD.ORG Sun May 18 17:45:31 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2DDE6106567B; Sun, 18 May 2008 17:45:31 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3A5A1065676 for ; Sun, 18 May 2008 17:45:30 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D403F8FC17 for ; Sun, 18 May 2008 17:45:30 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4IHjUCp048693 for ; Sun, 18 May 2008 17:45:30 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4IHjUZg048691 for perforce@freebsd.org; Sun, 18 May 2008 17:45:30 GMT (envelope-from rpaulo@FreeBSD.org) Date: Sun, 18 May 2008 17:45:30 GMT Message-Id: <200805181745.m4IHjUZg048691@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 141810 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 May 2008 17:45:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=141810 Change 141810 by rpaulo@rpaulo_epsilon on 2008/05/18 17:45:11 Use pcap_loop() instead of pcap_dispatch(). Affected files ... .. //depot/projects/soc2008/rpaulo-tcpad/main.c#4 edit Differences ... ==== //depot/projects/soc2008/rpaulo-tcpad/main.c#4 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2008/rpaulo-tcpad/main.c#3 $ + * $P4: //depot/projects/soc2008/rpaulo-tcpad/main.c#4 $ */ #include @@ -104,8 +104,11 @@ errx(1, "interface type not recognized"); LIST_INIT(&chead); - for (;;) { - pcap_dispatch(p, -1, tcpad_pcaphandler, - (unsigned char *)&linkhlen); - } + + pcap_loop(p, -1, tcpad_pcaphandler, (unsigned char *)&linkhlen); + + pcap_freecode(&fp); + pcap_close(p); + + return (0); }