From 35a3ff8b8d19b177846b08e6829d2e6094f31650 Mon Sep 17 00:00:00 2001
From: Christopher Bohn <bohn@unl.edu>
Date: Tue, 13 Jul 2021 13:21:35 -0500
Subject: [PATCH] Corrected bug in client in which the cursor isn't restored
 after SIGINT

---
 chat-client.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/chat-client.c b/chat-client.c
index fe608f5..876ad30 100644
--- a/chat-client.c
+++ b/chat-client.c
@@ -142,7 +142,18 @@ void *handle_outputs(void *window_arg) {
 void on_signal(int sig) {
     running = false;
     send_message(socket_fd, "EXIT");
-    cleanup();
+//    cleanup();
+    sigset(SIGINT, SIG_IGN);
+    sigset(SIGSEGV, SIG_IGN);
+    sigset(SIGABRT, SIG_IGN);
+    nocrmode();
+    echo();
+    nl();
+    curs_set(initial_cursor_state);
+    endwin();
+    close(socket_fd);
+    pthread_mutex_destroy(&mutex);
+
     fprintf(stderr, "Terminating due to signal %d.\n", sig);
     exit(128 + sig);
 }
-- 
GitLab