SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch
Takashi Iwai 1f78ef5d8d Accepting request 796087 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes for alsactl:
  0002-alsactl-don-t-exit-on-EINTR-from-epoll_wait.patch
  0003-alsactl-avoid-needless-wakeups-in-monitor-loop.patch
  0004-alsactl-fix-error-handling-for-sched_setscheduler-ca.patch

OBS-URL: https://build.opensuse.org/request/show/796087
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=171
2020-04-23 12:31:54 +00:00

39 lines
1.4 KiB
Diff

From d2bf87608a1c3f2d62ceb9300a74e9006394c678 Mon Sep 17 00:00:00 2001
From: Oscar65 <megia.oscar@gmail.com>
Date: Thu, 16 Apr 2020 12:35:21 +0200
Subject: [PATCH] alsactl: fix error handling for sched_setscheduler() call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 <megia.oscar@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsactl/alsactl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c
index dfb1db7f4a83..60d39459dedf 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));
--
2.16.4