From 070af11bb6e2e345484709d54c00de69d8aada96 Mon Sep 17 00:00:00 2001 From: ngn Date: Sat, 4 May 2024 22:36:57 +0300 Subject: [PATCH] new: segfault handler --- locale/tr/LC_MESSAGES/mc.po | 26 +++++++++++++++----------- src/main.c | 13 +++++++++++-- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/locale/tr/LC_MESSAGES/mc.po b/locale/tr/LC_MESSAGES/mc.po index d4e6f25..f9271a7 100644 --- a/locale/tr/LC_MESSAGES/mc.po +++ b/locale/tr/LC_MESSAGES/mc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-04 22:30+0300\n" +"POT-Creation-Date: 2024-05-04 22:36+0300\n" "PO-Revision-Date: 2024-05-01 13:34+0300\n" "Last-Translator: \n" "Language-Team: Turkish \n" @@ -115,47 +115,51 @@ msgstr "" msgid "Please answer with y/n" msgstr "" -#: src/main.c:72 +#: src/main.c:62 +msgid "Program received a segfault" +msgstr "" + +#: src/main.c:81 #, c-format msgid "Failed to access paths (%s)" msgstr "" -#: src/main.c:80 +#: src/main.c:89 msgid "Failed to lock, mc is already running" msgstr "" -#: src/main.c:83 +#: src/main.c:92 msgid "Failed to lock, did you mess up your directory permissions?" msgstr "" -#: src/main.c:92 +#: src/main.c:101 #, c-format msgid "%s: command failed" msgstr "" -#: src/main.c:96 +#: src/main.c:105 #, c-format msgid "%s: command successful" msgstr "" -#: src/main.c:100 +#: src/main.c:109 #, c-format msgid "MatterLinux Configuration Manager (%s)" msgstr "" -#: src/main.c:101 +#: src/main.c:110 msgid "Different operations are done using different commands\n" msgstr "" -#: src/main.c:104 +#: src/main.c:113 msgid "pull down a configuration" msgstr "" -#: src/main.c:107 +#: src/main.c:116 msgid "build the configuration in the current directory" msgstr "" -#: src/main.c:109 +#: src/main.c:118 msgid "" "Licensed under GPLv3, see for more " "information" diff --git a/src/main.c b/src/main.c index cc3396b..e857690 100644 --- a/src/main.c +++ b/src/main.c @@ -50,14 +50,23 @@ struct CmdMap cmdmap[] = { {.name = "mc-gen", .lock = false, .func = gen_cmd }, }; -void handler(int sig){ +void handler_int(int sig){ unlock(); printf("\e[?25h"); exit(1); } +void handler_seg(int sig){ + unlock(); + printf("\e[?25h"); + error(_("Program received a segfault")); + exit(1); +} + int main(int argc, char *argv[]) { - signal(SIGINT, handler); + signal(SIGINT, handler_int); + signal(SIGSEGV, handler_seg); + setbuf(stdout, NULL); setlocale(LC_ALL, ""); textdomain("mc");