1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Fix linux_alarm, the linux behaviour is to limit the

secs to INT_MAX when the passed in parameter is bigger
than INT_MAX.

Submitted by:	Dmitry Chagin <chagin.dmitry gmail com>
Approved by:	kib (mentor)
This commit is contained in:
Roman Divacky 2008-07-23 17:19:02 +00:00
parent a9337121a7
commit 0864e2a4f1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180766

View File

@ -170,6 +170,7 @@ int
linux_alarm(struct thread *td, struct linux_alarm_args *args)
{
struct itimerval it, old_it;
u_int secs;
int error;
#ifdef DEBUG
@ -177,10 +178,12 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args)
printf(ARGS(alarm, "%u"), args->secs);
#endif
if (args->secs > 100000000)
return (EINVAL);
secs = args->secs;
it.it_value.tv_sec = (long)args->secs;
if (secs > INT_MAX)
secs = INT_MAX;
it.it_value.tv_sec = (long) secs;
it.it_value.tv_usec = 0;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 0;