From 0864e2a4f14d7c4ac84cc379658579a809660ada Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Wed, 23 Jul 2008 17:19:02 +0000 Subject: [PATCH] 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 Approved by: kib (mentor) --- sys/compat/linux/linux_misc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index e9fdccc38bb1..57d315ffa2b3 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -170,17 +170,20 @@ int linux_alarm(struct thread *td, struct linux_alarm_args *args) { struct itimerval it, old_it; + u_int secs; int error; #ifdef DEBUG if (ldebug(alarm)) printf(ARGS(alarm, "%u"), args->secs); #endif + + secs = args->secs; - if (args->secs > 100000000) - return (EINVAL); + if (secs > INT_MAX) + secs = INT_MAX; - it.it_value.tv_sec = (long)args->secs; + 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;