]> git.hungrycats.org Git - linux/commitdiff
tools/power turbostat: Fix child's argument forwarding
authorPatryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Wed, 13 Nov 2024 14:48:22 +0000 (15:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:34 +0000 (13:54 +0100)
[ Upstream commit 1da0daf746342dfdc114e4dc8fbf3ece28666d4f ]

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: 3e4048466c39 ("tools/power turbostat: Add --no-msr option")
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/power/x86/turbostat/turbostat.c

index aa9200319d0eafa7de394f91ad5b1113317f1749..a5ebee8b23bbe31425d8477bfcc1abec2c4915bc 100644 (file)
@@ -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;