From 1b21827f1f875692e14ee5ac9b22f3fd69fd8593 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 19 Oct 2012 18:59:48 +0000 Subject: Fail gracefully when /proc is not mounted (thanks to Philipp Hagemeister) --- CRT.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'CRT.c') diff --git a/CRT.c b/CRT.c index 97f2144e..6cc979f7 100644 --- a/CRT.c +++ b/CRT.c @@ -11,8 +11,10 @@ in the source distribution for its full text. #include "String.h" #include +#include #include #include +#include #ifdef HAVE_EXECINFO_H #include #endif @@ -198,6 +200,13 @@ void CRT_done() { endwin(); } +void CRT_fatalError(const char* note) { + char* sysMsg = strerror(errno); + CRT_done(); + fprintf(stderr, "%s: %s\n", note, sysMsg); + exit(2); +} + int CRT_readKey() { nocbreak(); cbreak(); -- cgit v1.2.3