Skip to content

Commit

Permalink
tools/power turbostat: Fix child's argument forwarding
Browse files Browse the repository at this point in the history
[ Upstream commit 1da0daf ]

Add '+' to optstring when early scanning for --no-msr and --no-perf.
It causes option processing to stop as soon as a nonoption argument is
encountered, effectively skipping child's arguments.

Fixes: 3e40484 ("tools/power turbostat: Add --no-msr option")
Signed-off-by: Patryk Wlazlyn <[email protected]>
Signed-off-by: Len Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Patryk Wlazlyn authored and gregkh committed Dec 5, 2024
1 parent 2409cf4 commit 54baa8f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9784,7 +9784,7 @@ void cmdline(int argc, char **argv)
* Parse some options early, because they may make other options invalid,
* like adding the MSR counter with --add and at the same time using --no-msr.
*/
while ((opt = getopt_long_only(argc, argv, "MPn:", long_options, &option_index)) != -1) {
while ((opt = getopt_long_only(argc, argv, "+MPn:", long_options, &option_index)) != -1) {
switch (opt) {
case 'M':
no_msr = 1;
Expand Down

0 comments on commit 54baa8f

Please sign in to comment.