Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/thermal/thermal-engine: Fix format string bug in thermal-engine

The error message in the daemon() failure path uses %p format specifier
without providing a corresponding pointer argument, resulting in undefined
behavior and printing garbage values.

Replace %p with %m to properly print the errno error message, which is
the intended behavior when daemon() fails.

This fix ensures proper error reporting when daemonization fails.

Signed-off-by: Malaya Kumar Rout <mrout@redhat.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/20251124104401.374856-1-mrout@redhat.com

authored by

Malaya Kumar Rout and committed by
Daniel Lezcano
16e80266 a6eb1771

+1 -1
+1 -1
tools/thermal/thermal-engine/thermal-engine.c
··· 374 374 } 375 375 376 376 if (options.daemonize && daemon(0, 0)) { 377 - ERROR("Failed to daemonize: %p\n"); 377 + ERROR("Failed to daemonize: %m\n"); 378 378 return THERMAL_ENGINE_DAEMON_ERROR; 379 379 } 380 380