]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/thermal/thermal-engine: Fix format string bug in thermal-engine
authorMalaya Kumar Rout <mrout@redhat.com>
Mon, 24 Nov 2025 10:43:58 +0000 (16:13 +0530)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 25 Nov 2025 10:00:28 +0000 (11:00 +0100)
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
tools/thermal/thermal-engine/thermal-engine.c

index 0764dc754771556bf88f4e0e649707dc79651555..66b0ba1fcd23472593288ac63a91605e63cdfd66 100644 (file)
@@ -374,7 +374,7 @@ int main(int argc, char *argv[])
        }
 
        if (options.daemonize && daemon(0, 0)) {
-               ERROR("Failed to daemonize: %p\n");
+               ERROR("Failed to daemonize: %m\n");
                return THERMAL_ENGINE_DAEMON_ERROR;
        }