Subject: Re: pkg/24217: Wrong use of usleep() in wget 1.9.1 pkg
To: None <netbsd-bugs@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 01/24/2004 20:32:39
> >Synopsis: usleep() is used the wrong way in Wget 1.9.1 pkg
> Unfortunately, the good people has not read usleep(3), which
> says you must not call usleep with a value greater than 10**6.
> Instead their lines goes like:
>
> usleep(1000000L * opt.wait);
>
> which we but of course honor with a return value of -1 and an
> errno set at EINVAL. They do not check it though... Net result:
> no sleeping.
An alternative is to change the:
usleep(1000000L * timeout);
to
poll(0, 0, 1000L * timeout);
Which has the added advantage that isn't allowed to be implemented
in terms of the alarm timer and SIGALRM.
David
--
David Laight: david@l8s.co.uk