summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dged/keyboard.c2
-rw-r--r--src/main/main.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/dged/keyboard.c b/src/dged/keyboard.c
index f13d449..1e28066 100644
--- a/src/dged/keyboard.c
+++ b/src/dged/keyboard.c
@@ -108,7 +108,7 @@ struct keyboard_update keyboard_update(struct keyboard *kbd,
}
// read all input in chunks of `bufsize` bytes
- const uint32_t bufsize = 128;
+ const uint32_t bufsize = 1024;
uint8_t *buf = malloc(bufsize), *writepos = buf;
int nbytes = 0, nread = 0;
while ((nread = read(kbd->fd, writepos, bufsize)) == bufsize) {
diff --git a/src/main/main.c b/src/main/main.c
index b96edd4..a1703ce 100644
--- a/src/main/main.c
+++ b/src/main/main.c
@@ -53,6 +53,18 @@ void resized() {
signal(SIGWINCH, resized);
}
+void segfault() {
+ // make an effort to restore the
+ // terminal to its former glory
+ if (display != NULL) {
+ display_clear(display);
+ display_destroy(display);
+ }
+
+ printf("Segfault encountered...\n");
+ abort();
+}
+
#define INVALID_WATCH -1
struct watched_file {
uint32_t watch_id;
@@ -156,6 +168,7 @@ int main(int argc, char *argv[]) {
setlocale(LC_ALL, "");
signal(SIGTERM, terminate);
+ signal(SIGSEGV, segfault);
struct commands commands = command_registry_create(32);