[PATCH] perf tools: delay_secs safety
From: Tim Blechmann
Date: Sat Oct 17 2009 - 12:09:11 EST
add delay_secs sanity check to handle_keypress, fixes a division by
zero crash.
Signed-off-by: Tim Blechmann <tim@xxxxxxxxxx>
---
tools/perf/builtin-top.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 2d8806b..cc66286 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -663,6 +663,8 @@ static void handle_keypress(int c)
switch (c) {
case 'd':
prompt_integer(&delay_secs, "Enter display delay");
+ if (delay_secs < 1)
+ delay_secs = 1;
break;
case 'e':
prompt_integer(&print_entries, "Enter display entries (lines)");
Attachment:
signature.asc
Description: OpenPGP digital signature