Do more error check in display_init()
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
diff --git a/powerdebug.c b/powerdebug.c
index 8244df2..215b0fe 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -261,8 +261,9 @@
struct timeval tval;
fd_set readfds;
- if (firsttime[0])
- display_init();
+ if (firsttime[0] && display_init())
+ return -1;
+
create_windows(options->selectedwindow);
show_header(options->selectedwindow);
@@ -395,6 +396,11 @@
return 0;
}
+ if (display_init()) {
+ printf("failed to initialize display\n");
+ return 1;
+ }
+
if (mainloop(options, regulators_info, numregulators))
return 1;