new: segfault handler

This commit is contained in:
ngn 2024-05-04 22:36:57 +03:00
parent c439f30820
commit 070af11bb6
2 changed files with 26 additions and 13 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: 2024-05-01 13:34+0300\n"
"Last-Translator: <ngn@ngn.tf>\n" "Last-Translator: <ngn@ngn.tf>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n" "Language-Team: Turkish <gnome-turk@gnome.org>\n"
@ -115,47 +115,51 @@ msgstr ""
msgid "Please answer with y/n" msgid "Please answer with y/n"
msgstr "" msgstr ""
#: src/main.c:72 #: src/main.c:62
msgid "Program received a segfault"
msgstr ""
#: src/main.c:81
#, c-format #, c-format
msgid "Failed to access paths (%s)" msgid "Failed to access paths (%s)"
msgstr "" msgstr ""
#: src/main.c:80 #: src/main.c:89
msgid "Failed to lock, mc is already running" msgid "Failed to lock, mc is already running"
msgstr "" msgstr ""
#: src/main.c:83 #: src/main.c:92
msgid "Failed to lock, did you mess up your directory permissions?" msgid "Failed to lock, did you mess up your directory permissions?"
msgstr "" msgstr ""
#: src/main.c:92 #: src/main.c:101
#, c-format #, c-format
msgid "%s: command failed" msgid "%s: command failed"
msgstr "" msgstr ""
#: src/main.c:96 #: src/main.c:105
#, c-format #, c-format
msgid "%s: command successful" msgid "%s: command successful"
msgstr "" msgstr ""
#: src/main.c:100 #: src/main.c:109
#, c-format #, c-format
msgid "MatterLinux Configuration Manager (%s)" msgid "MatterLinux Configuration Manager (%s)"
msgstr "" msgstr ""
#: src/main.c:101 #: src/main.c:110
msgid "Different operations are done using different commands\n" msgid "Different operations are done using different commands\n"
msgstr "" msgstr ""
#: src/main.c:104 #: src/main.c:113
msgid "pull down a configuration" msgid "pull down a configuration"
msgstr "" msgstr ""
#: src/main.c:107 #: src/main.c:116
msgid "build the configuration in the current directory" msgid "build the configuration in the current directory"
msgstr "" msgstr ""
#: src/main.c:109 #: src/main.c:118
msgid "" msgid ""
"Licensed under GPLv3, see <https://www.gnu.org/licenses/> for more " "Licensed under GPLv3, see <https://www.gnu.org/licenses/> for more "
"information" "information"

View File

@ -50,14 +50,23 @@ struct CmdMap cmdmap[] = {
{.name = "mc-gen", .lock = false, .func = gen_cmd }, {.name = "mc-gen", .lock = false, .func = gen_cmd },
}; };
void handler(int sig){ void handler_int(int sig){
unlock(); unlock();
printf("\e[?25h"); printf("\e[?25h");
exit(1); exit(1);
} }
void handler_seg(int sig){
unlock();
printf("\e[?25h");
error(_("Program received a segfault"));
exit(1);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
signal(SIGINT, handler); signal(SIGINT, handler_int);
signal(SIGSEGV, handler_seg);
setbuf(stdout, NULL); setbuf(stdout, NULL);
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
textdomain("mc"); textdomain("mc");