summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-09-05 21:41:39 +0200
committerBram Moolenaar <Bram@vim.org>2013-09-05 21:41:39 +0200
commitbec9c20884290cc64e63d4eec531c0a2fbdcd3f6 (patch)
tree6a671564863f197e0d8bf4a471a6a72e149816b3 /src/os_unix.c
parent9be44818921a9255b3a26bf5566f1939bf38804e (diff)
downloadvim-bec9c20884290cc64e63d4eec531c0a2fbdcd3f6.zip
updated for version 7.4.022
Problem: Deadlock while exiting, because of allocating memory. Solution: Do not use gettext() in deathtrap(). (James McCoy)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 37cc3a7dd..cc026534d 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -957,8 +957,10 @@ mch_didjmp()
/*
* This function handles deadly signals.
- * It tries to preserve any swap file and exit properly.
+ * It tries to preserve any swap files and exit properly.
* (partly from Elvis).
+ * NOTE: Avoid unsafe functions, such as allocating memory, they can result in
+ * a deadlock.
*/
static RETSIGTYPE
deathtrap SIGDEFARG(sigarg)
@@ -1090,18 +1092,23 @@ deathtrap SIGDEFARG(sigarg)
}
if (entered == 2)
{
- OUT_STR(_("Vim: Double signal, exiting\n"));
+ /* No translation, it may call malloc(). */
+ OUT_STR("Vim: Double signal, exiting\n");
out_flush();
getout(1);
}
+ /* No translation, it may call malloc(). */
#ifdef SIGHASARG
- sprintf((char *)IObuff, _("Vim: Caught deadly signal %s\n"),
+ sprintf((char *)IObuff, "Vim: Caught deadly signal %s\n",
signal_info[i].name);
#else
- sprintf((char *)IObuff, _("Vim: Caught deadly signal\n"));
+ sprintf((char *)IObuff, "Vim: Caught deadly signal\n");
#endif
- preserve_exit(); /* preserve files and exit */
+
+ /* Preserve files and exit. This sets the really_exiting flag to prevent
+ * calling free(). */
+ preserve_exit();
#ifdef NBDEBUG
reset_signals();