summaryrefslogtreecommitdiff
path: root/nptl/pthread_attr_setschedparam.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-04-24 08:00:37 +0000
committerJakub Jelinek <jakub@redhat.com>2009-04-24 08:00:37 +0000
commit7dec33c08e4755e72d1280e48e61f0141dfc1da5 (patch)
tree22aa7aa8ebc1f795e180c8c0d99cdda7d2a3ffef /nptl/pthread_attr_setschedparam.c
parent335206256c84eaefab082284523e5b8f89fcffb2 (diff)
Updated to fedora-glibc-20090424T0747cvs/fedora-glibc-2_9_90-20
Diffstat (limited to 'nptl/pthread_attr_setschedparam.c')
-rw-r--r--nptl/pthread_attr_setschedparam.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nptl/pthread_attr_setschedparam.c b/nptl/pthread_attr_setschedparam.c
index 976ad13873..b4d4bbe055 100644
--- a/nptl/pthread_attr_setschedparam.c
+++ b/nptl/pthread_attr_setschedparam.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -31,6 +31,12 @@ __pthread_attr_setschedparam (attr, param)
assert (sizeof (*attr) >= sizeof (struct pthread_attr));
struct pthread_attr *iattr = (struct pthread_attr *) attr;
+ int min = sched_get_priority_min (iattr->schedpolicy);
+ int max = sched_get_priority_max (iattr->schedpolicy);
+ if (min == -1 || max == -1
+ || param->sched_priority > max || param->sched_priority < min)
+ return EINVAL;
+
/* Copy the new values. */
memcpy (&iattr->schedparam, param, sizeof (struct sched_param));