comparison src/os_unix.c @ 5338:965044860b7f v7.4.022

updated for version 7.4.022 Problem: Deadlock while exiting, because of allocating memory. Solution: Do not use gettext() in deathtrap(). (James McCoy)
author Bram Moolenaar <bram@vim.org>
date Thu, 05 Sep 2013 21:41:39 +0200
parents a68629544891
children 8d83c219fc7b
comparison
equal deleted inserted replaced
5337:09ecbbbdee62 5338:965044860b7f
955 } 955 }
956 #endif 956 #endif
957 957
958 /* 958 /*
959 * This function handles deadly signals. 959 * This function handles deadly signals.
960 * It tries to preserve any swap file and exit properly. 960 * It tries to preserve any swap files and exit properly.
961 * (partly from Elvis). 961 * (partly from Elvis).
962 * NOTE: Avoid unsafe functions, such as allocating memory, they can result in
963 * a deadlock.
962 */ 964 */
963 static RETSIGTYPE 965 static RETSIGTYPE
964 deathtrap SIGDEFARG(sigarg) 966 deathtrap SIGDEFARG(sigarg)
965 { 967 {
966 static int entered = 0; /* count the number of times we got here. 968 static int entered = 0; /* count the number of times we got here.
1088 _exit(8); 1090 _exit(8);
1089 exit(7); 1091 exit(7);
1090 } 1092 }
1091 if (entered == 2) 1093 if (entered == 2)
1092 { 1094 {
1093 OUT_STR(_("Vim: Double signal, exiting\n")); 1095 /* No translation, it may call malloc(). */
1096 OUT_STR("Vim: Double signal, exiting\n");
1094 out_flush(); 1097 out_flush();
1095 getout(1); 1098 getout(1);
1096 } 1099 }
1097 1100
1101 /* No translation, it may call malloc(). */
1098 #ifdef SIGHASARG 1102 #ifdef SIGHASARG
1099 sprintf((char *)IObuff, _("Vim: Caught deadly signal %s\n"), 1103 sprintf((char *)IObuff, "Vim: Caught deadly signal %s\n",
1100 signal_info[i].name); 1104 signal_info[i].name);
1101 #else 1105 #else
1102 sprintf((char *)IObuff, _("Vim: Caught deadly signal\n")); 1106 sprintf((char *)IObuff, "Vim: Caught deadly signal\n");
1103 #endif 1107 #endif
1104 preserve_exit(); /* preserve files and exit */ 1108
1109 /* Preserve files and exit. This sets the really_exiting flag to prevent
1110 * calling free(). */
1111 preserve_exit();
1105 1112
1106 #ifdef NBDEBUG 1113 #ifdef NBDEBUG
1107 reset_signals(); 1114 reset_signals();
1108 may_core_dump(); 1115 may_core_dump();
1109 abort(); 1116 abort();