ports/139814: arpalert exits with EINVAL of select()
Fumiyuki Shimizu
fumifumi at abacustech.jp
Wed Oct 21 11:20:02 UTC 2009
>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:
More information about the freebsd-ports-bugs
mailing list