regedit: add a panic handler to restore terminal
authorChris Davis <cd.rattan@gmail.com>
Tue, 1 Jul 2014 23:00:16 +0000 (16:00 -0700)
committerMichael Adam <obnox@samba.org>
Wed, 1 Oct 2014 12:32:09 +0000 (14:32 +0200)
Signed-off-by: Chris Davis <cd.rattan@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/utils/regedit.c

index 8fca96bd18d4ce7aa113240e9335be431cf2212c..5b7885ca3e1878ebe410c4eaac085e492390e1ee 100644 (file)
@@ -567,6 +567,12 @@ int regedit_getch(void)
        return c;
 }
 
+static void regedit_panic_handler(const char *msg)
+{
+       endwin();
+       smb_panic_s3(msg);
+}
+
 static void display_window(TALLOC_CTX *mem_ctx, struct registry_context *ctx)
 {
        struct regedit *regedit;
@@ -579,6 +585,8 @@ static void display_window(TALLOC_CTX *mem_ctx, struct registry_context *ctx)
        cbreak();
        noecho();
 
+       fault_configure(regedit_panic_handler);
+
        colors = has_colors();
        if (colors) {
                start_color();