From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Oct 21 11:20:02 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 329E91065676 for ; Wed, 21 Oct 2009 11:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id EACF98FC18 for ; Wed, 21 Oct 2009 11:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9LBK1a8057489 for ; Wed, 21 Oct 2009 11:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9LBK1VX057488; Wed, 21 Oct 2009 11:20:01 GMT (envelope-from gnats) Resent-Date: Wed, 21 Oct 2009 11:20:01 GMT Resent-Message-Id: <200910211120.n9LBK1VX057488@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Fumiyuki Shimizu Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D818E106566B for ; Wed, 21 Oct 2009 11:14:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id C78DE8FC1D for ; Wed, 21 Oct 2009 11:14:35 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9LBEZmW038753 for ; Wed, 21 Oct 2009 11:14:35 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n9LBEZZl038752; Wed, 21 Oct 2009 11:14:35 GMT (envelope-from nobody) Message-Id: <200910211114.n9LBEZZl038752@www.freebsd.org> Date: Wed, 21 Oct 2009 11:14:35 GMT From: Fumiyuki Shimizu To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/139814: arpalert exits with EINVAL of select() X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Oct 2009 11:20:02 -0000 >Number: 139814 >Category: ports >Synopsis: arpalert exits with EINVAL of select() >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 21 11:20:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Fumiyuki Shimizu >Release: 7.1-RELEASE >Organization: Abacus Technologies, Inc. >Environment: 7.1-RELEASE-p8 FreeBSD 7.1-RELEASE-p8 #11: Thu Oct 8 16:51:48 JST 2009 :/usr/obj/usr/src/sys/00fumifumi i386 >Description: arpalert exits with a syslog message arpalert: [./arpalert.c 210] select[22]: Invalid argument select() on BSD systems returns EINVAL if tv_usec of timeval is >= 1000000, while GNU/Linux system (possibly the developer's environment) does not. >How-To-Repeat: Run arpalert for long long time. >Fix: Tentative fix is attached. I have also e-mailed a suggestion to the arpalert project to fix essentialy. Patch attached with submission follows: --- arpalert.c.orig 2008-04-01 03:36:42.000000000 +0900 +++ arpalert.c 2009-10-21 19:45:53.000000000 +0900 @@ -179,6 +179,12 @@ if(cur_timeout.tv_sec != -1){ time_sous(&cur_timeout, ¤t_t, &timeout); + if (0 > timeout.tv_usec) { + /* avoid EINVAL (paranoid) */ + timeout.tv_sec -= (timeout.tv_usec / 1000000) + 1; + timeout.tv_usec = (timeout.tv_usec % 1000000) + 1000000; + } + // prevent negative timeout if(timeout.tv_sec < 0){ timeout.tv_usec = 0; @@ -188,6 +194,12 @@ timeout.tv_usec += 10000; tmout = &timeout; + if (1000000 <= timeout.tv_usec) { + /* avoid EINVAL */ + timeout.tv_sec += timeout.tv_usec / 1000000; + timeout.tv_usec %= 1000000; + } + // if no timeout } else { tmout = NULL; >Release-Note: >Audit-Trail: >Unformatted: