From da1304bcc8d718f40e58d92726c0fbc7b0d0794d Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Mon, 22 Apr 2013 10:28:31 +0530 Subject: Consolidate pthread_attr value validation Define inline functions that wrap around validation for each of the pthread attributes to reduce duplication in code. --- nptl/pthread_attr_setschedparam.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'nptl/pthread_attr_setschedparam.c') diff --git a/nptl/pthread_attr_setschedparam.c b/nptl/pthread_attr_setschedparam.c index ec1a8bd444..a167f153d1 100644 --- a/nptl/pthread_attr_setschedparam.c +++ b/nptl/pthread_attr_setschedparam.c @@ -30,11 +30,10 @@ __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; + int ret = check_sched_priority_attr (param->sched_priority, + iattr->schedpolicy); + if (ret) + return ret; /* Copy the new values. */ memcpy (&iattr->schedparam, param, sizeof (struct sched_param)); -- cgit v1.2.3