summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Davis <cd.rattan@gmail.com>2014-07-01 16:00:16 -0700
committerMichael Adam <obnox@samba.org>2014-10-01 14:32:09 +0200
commitfec275a4a8e9ecd77fb30c4a242a2fe832d9f41c (patch)
tree66ab3b5ce4ea475e4d254b9782fc131afb2ebc1d
parentf9a2f2eb7cc3c69f20ab615dd98b750414672fe3 (diff)
downloadsamba-fec275a4a8e9ecd77fb30c4a242a2fe832d9f41c.tar.gz
samba-fec275a4a8e9ecd77fb30c4a242a2fe832d9f41c.tar.xz
samba-fec275a4a8e9ecd77fb30c4a242a2fe832d9f41c.zip
regedit: add a panic handler to restore terminal
Signed-off-by: Chris Davis <cd.rattan@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r--source3/utils/regedit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c
index 8fca96bd18..5b7885ca3e 100644
--- a/source3/utils/regedit.c
+++ b/source3/utils/regedit.c
@@ -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();