diff options
-rw-r--r-- | Modules/posixmodule.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d9d9acb989..df597b887b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4741,7 +4741,13 @@ posix_sched_setscheduler(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, _Py_PARSE_PID "iO&:sched_setscheduler", &pid, &policy, &convert_sched_param, ¶m)) return NULL; - if (sched_setscheduler(pid, policy, ¶m)) + + /* + ** sched_setscheduler() returns 0 in Linux, but + ** the previous scheduling policy. + ** On error, -1 is returned in all Operative Systems. + */ + if (sched_setscheduler(pid, policy, ¶m) == -1) return posix_error(); Py_RETURN_NONE; } |