From: Oscar65 Date: Thu, 16 Apr 2020 10:35:21 +0000 (+0200) Subject: alsactl: fix error handling for sched_setscheduler() call X-Git-Tag: v1.2.3~17 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d2bf87608a1c3f2d62ceb9300a74e9006394c678;p=alsa-utils.git alsactl: fix error handling for sched_setscheduler() call As man page says: "If successful, the sched_setparam() function shall return zero." Without update I got this output in the syslog (journalctl): abr 16 09:25:30 mypc alsactl[1652]: alsactl 1.2.2 daemon started abr 16 09:25:30 mypc alsactl[1652]: /usr/bin/alsactl: do_nice:165sched_setparam failed: No such file or directory If sched_setscheduler() returns 0, so it means that the call was successful. Signed-off-by: Oscar MegĂ­a Signed-off-by: Jaroslav Kysela --- diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c index dfb1db7..60d3945 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c @@ -161,7 +161,7 @@ static void do_nice(int use_nice, int sched_idle) if (sched_idle) { if (sched_getparam(0, &sched_param) >= 0) { sched_param.sched_priority = 0; - if (!sched_setscheduler(0, SCHED_IDLE, &sched_param)) + if (sched_setscheduler(0, SCHED_IDLE, &sched_param) < 0) error("sched_setparam failed: %s", strerror(errno)); } else { error("sched_getparam failed: %s", strerror(errno));