[PATCH stalld 52/52] stalld: fix format string type mismatch in set_cpu_affinity
Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:32:02 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
The error message after sched_setaffinity() fails uses %d to print the result of strerror(), which returns a char pointer. This is undefined behavior and prints a meaningless integer instead of the error description. Use %s to format the string correctly. Signed-off-by: Wander Lairson Costa <[email protected]> --- src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.c b/src/utils.c index b3b17dd..1a90b32 100644 --- a/src/utils.c +++ b/src/utils.c @@ -920,7 +920,7 @@ int set_cpu_affinity(char *cpu_list) retval = sched_setaffinity(getpid(), sizeof(set), &set); if (retval == -1) { - log_msg("self-affinity: error setting affinity %d", strerror(errno)); + log_msg("self-affinity: error setting affinity: %s\n", strerror(errno)); return -1; } -- 2.54.0