diff mbox series

[2/6] rt-tests: cyclictest: Report all errors from pthread_setaffinity_np

Message ID 20200302214430.15825-3-jkacur@redhat.com
State New
Headers show
Series Affinity devel and fixes | expand

Commit Message

John Kacur March 2, 2020, 9:44 p.m. UTC
On error pthread_setaffinity_np returns a non-zero number.
Make sure cyclictest prints a warning in all such cases.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/cyclictest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index c66755dd4d87..bd1fcd1092aa 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -650,7 +650,7 @@  static void *timerthread(void *param)
 		CPU_ZERO(&mask);
 		CPU_SET(par->cpu, &mask);
 		thread = pthread_self();
-		if (pthread_setaffinity_np(thread, sizeof(mask), &mask) == -1)
+		if (pthread_setaffinity_np(thread, sizeof(mask), &mask) != 0)
 			warn("Could not set CPU affinity to CPU #%d\n",
 			     par->cpu);
 	}