From 6ff67988785af818b97a7175c8ca80f2ee2d039f Mon Sep 17 00:00:00 2001
From: csbo98 <boliu98@foxmail.com>
Date: Sun, 22 May 2022 14:47:13 +0800
Subject: [PATCH] Maybe there is a little mistake in do_taskset() function in
 taskset.c. In the first call of sched_getaffinity(), if the call is failed we
 should use err_affinity(ts->pid, 0) other than err_affinity(ts->pid, 1).
---
 schedutils/taskset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index 224cfbe23..0ab7d12e2 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -117,7 +117,7 @@ static void do_taskset(struct taskset *ts, size_t setsize, cpu_set_t *set)
 	/* read the current mask */
 	if (ts->pid) {
 		if (sched_getaffinity(ts->pid, ts->setsize, ts->set) < 0)
-			err_affinity(ts->pid, 1);
+			err_affinity(ts->pid, 0);
 		print_affinity(ts, FALSE);
 	}
 
-- 
2.33.0

