From 813507742ead365b9841df5ac32951c8bf953204 Mon Sep 17 00:00:00 2001 From: Amit Arora Date: Tue, 16 Nov 2010 14:56:26 +0530 Subject: Bug: fix sigsegv for -cd options --- clocks.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'clocks.c') diff --git a/clocks.c b/clocks.c index 5eaed47..de2375a 100644 --- a/clocks.c +++ b/clocks.c @@ -29,22 +29,36 @@ int init_clock_details(void) if (path) strcpy(clk_dir_path, path); else { - create_selectedwindow(); - sprintf(clock_lines[0], "Unable to locate debugfs mount point." - " Mount debugfs and try again..\n"); - print_one_clock(0, clock_lines[0], 1, 0); - old_clock_line_no = 1; - return(1); + if (!dump) { + create_selectedwindow(); + sprintf(clock_lines[0], "Unable to locate debugfs " + "mount point. Mount debugfs " + "and try again..\n"); + print_one_clock(0, clock_lines[0], 1, 0); + old_clock_line_no = 1; + return(1); + } else { + fprintf(stderr, "powerdebug: Unable to locate debugfs " + "mount point. Mount debugfs and try " + "again..\n"); + exit(1); + } } sprintf(clk_dir_path, "%s/clock", clk_dir_path); //strcpy(clk_dir_path, "/debug/clock"); // Hardcoded for testing.. if (stat(clk_dir_path, &buf)) { - create_selectedwindow(); - sprintf(clock_lines[0], "Unable to find clock tree" - " information at %s.\n", clk_dir_path); - print_one_clock(0, clock_lines[0], 1, 0); - old_clock_line_no = 1; - return(1); + if (!dump) { + create_selectedwindow(); + sprintf(clock_lines[0], "Unable to find clock tree" + " information at %s.\n", clk_dir_path); + print_one_clock(0, clock_lines[0], 1, 0); + old_clock_line_no = 1; + return(1); + } else { + fprintf(stderr, "powerdebug: Unable to find clock tree" + " information at %s.\n", clk_dir_path); + exit(1); + } } strcpy(clk_name, ""); return(0); -- cgit v1.2.3