diff mbox series

[v2,1/4] trace-cmd reset: Bail out immediately if user provides an invalid option

Message ID 20241014123136.3890807-2-metin.kaya@arm.com (mailing list archive)
State Accepted
Commit cc6de7360c24229080a5f62d1beb8882c20ebbea
Headers show
Series trace-cmd reset: Add option to preserve specific events | expand

Commit Message

Metin Kaya Oct. 14, 2024, 12:31 p.m. UTC
trace_reset() does not care invalid command line options and carries on
execution. For instance, "trace-cmd reset -x" command successfully
completes the reset request (despite of "reset: invalid option -- 'x'"
warning). Thus, show the usage message and terminate execution instead
of running the reset routine.

Signed-off-by: Metin Kaya <metin.kaya@arm.com>
---
 tracecmd/trace-record.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 0063d528..8c0039d4 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -6102,6 +6102,9 @@  void trace_reset(int argc, char **argv)
 				instance->flags &= ~BUFFER_FL_KEEP;
 			}
 			break;
+		default:
+			usage(argv);
+			break;
 		}
 	}
 	update_first_instance(instance, topt);