Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] open_posix_testsuite/sched_yield: Fix sched_setscheduler() check
@ 2026-09-28  8:36 yang.zhang
  2026-09-29  7:06 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 4+ messages in thread
From: yang.zhang @ 2026-09-28  8:36 UTC (permalink / raw)
  To: ltp; +Cc: yang.zhang

From: "yang.zhang" <zhangyang01@kylinos.cn>

POSIX specifies that sched_setscheduler() returns the former scheduling
policy on success and -1 on failure.  Treating every nonzero return value
as an error incorrectly rejects valid previous policies.

Check explicitly for -1.

Signed-off-by: yang.zhang <zhangyang01@kylinos.cn>
---
 .../conformance/interfaces/sched_yield/1-1.c                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c
index 922b1aa1f..9c5189af9 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c
@@ -82,7 +82,7 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
 	/* get in FIFO */
 	sp.sched_priority = sched_get_priority_min(SCHED_FIFO);
 	rc = sched_setscheduler(getpid(), SCHED_FIFO, &sp);
-	if (rc) {
+	if (rc == -1) {
 		ERR_LOG("sched_setscheduler", rc);
 		return status;
 	}
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-05 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28  8:36 [LTP] [PATCH] open_posix_testsuite/sched_yield: Fix sched_setscheduler() check yang.zhang
2026-09-29  7:06 ` [LTP] " linuxtestproject.agent
2026-10-05 12:10   ` Andrea Cervesato via ltp
2026-10-05 12:11   ` Andrea Cervesato via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox