From: Yiwei Lin <s921975628@gmail.com>
To: trenn@suse.com, shuah@kernel.org
Cc: jwyatt@redhat.com, jkacur@redhat.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, Yiwei Lin <s921975628@gmail.com>
Subject: [PATCH] cpupower: monitor: Exit with error status if execvp() fail
Date: Tue, 11 Feb 2025 18:05:30 +0800 [thread overview]
Message-ID: <20250211100530.5918-1-s921975628@gmail.com> (raw)
In the case that we give a invalid command to idle_monitor for
monitoring, the execvp() will fail and thus go to the next line.
As a result, we'll see two differnt monitoring output. For
example, running `cpupower monitor -i 5 invalidcmd` which `invalidcmd`
is not executable.
Signed-off-by: Yiwei Lin <s921975628@gmail.com>
---
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index f746099b5dac..0fc0e229739d 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -6,6 +6,7 @@
*/
+#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -295,6 +296,7 @@ int fork_it(char **argv)
if (!child_pid) {
/* child */
execvp(argv[0], argv);
+ exit(errno);
} else {
/* parent */
if (child_pid == -1) {
--
2.34.1
next reply other threads:[~2025-02-11 10:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 10:05 Yiwei Lin [this message]
2025-02-19 20:27 ` [PATCH] cpupower: monitor: Exit with error status if execvp() fail Shuah Khan
2025-02-20 12:28 ` Yiwei Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250211100530.5918-1-s921975628@gmail.com \
--to=s921975628@gmail.com \
--cc=jkacur@redhat.com \
--cc=jwyatt@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=trenn@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox