Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241224070623.2419229-1-yan.li.cn@windriver.com>
Date: Tue, 24 Dec 2024 15:06:23 +0800
From: <yan.li.cn@...driver.com>
To: <musl@...ts.openwall.com>
CC: <yan.li.cn@...driver.com>
Subject: [PATCH] add check for pthread_attr_setschedpolicy

From: Yan Li <yan.li.cn@...driver.com>

---
 src/thread/pthread_attr_setschedpolicy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 src/thread/pthread_attr_setschedpolicy.c

diff --git a/src/thread/pthread_attr_setschedpolicy.c b/src/thread/pthread_attr_setschedpolicy.c
old mode 100644
new mode 100755
index bb71f393..f943e3c5
--- a/src/thread/pthread_attr_setschedpolicy.c
+++ b/src/thread/pthread_attr_setschedpolicy.c
@@ -2,6 +2,10 @@
 
 int pthread_attr_setschedpolicy(pthread_attr_t *a, int policy)
 {
-	a->_a_policy = policy;
-	return 0;
+    if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR){
+        return EINVAL;
+    }
+
+    a->_a_policy = policy;
+    return 0;
 }
-- 
2.34.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.