File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -9174,6 +9174,8 @@ prepare_to_exit()
9174
9174
/*
9175
9175
* Preserve files and exit.
9176
9176
* When called IObuff must contain a message.
9177
+ * NOTE: This may be called from deathtrap() in a signal handler, avoid unsafe
9178
+ * functions, such as allocating memory.
9177
9179
*/
9178
9180
void
9179
9181
preserve_exit ()
@@ -9196,7 +9198,7 @@ preserve_exit()
9196
9198
{
9197
9199
if (buf -> b_ml .ml_mfp != NULL && buf -> b_ml .ml_mfp -> mf_fname != NULL )
9198
9200
{
9199
- OUT_STR (_ ( "Vim: preserving files...\n" ) );
9201
+ OUT_STR ("Vim: preserving files...\n" );
9200
9202
screen_start (); /* don't know where cursor is now */
9201
9203
out_flush ();
9202
9204
ml_sync_all (FALSE, FALSE); /* preserve all swap files */
@@ -9206,7 +9208,7 @@ preserve_exit()
9206
9208
9207
9209
ml_close_all (FALSE); /* close all memfiles, without deleting */
9208
9210
9209
- OUT_STR (_ ( "Vim: Finished.\n" ) );
9211
+ OUT_STR ("Vim: Finished.\n" );
9210
9212
9211
9213
getout (1 );
9212
9214
}
Original file line number Diff line number Diff line change @@ -957,8 +957,10 @@ mch_didjmp()
957
957
958
958
/*
959
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
961
* (partly from Elvis).
962
+ * NOTE: Avoid unsafe functions, such as allocating memory, they can result in
963
+ * a deadlock.
962
964
*/
963
965
static RETSIGTYPE
964
966
deathtrap SIGDEFARG (sigarg )
@@ -1090,18 +1092,23 @@ deathtrap SIGDEFARG(sigarg)
1090
1092
}
1091
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
1097
out_flush ();
1095
1098
getout (1 );
1096
1099
}
1097
1100
1101
+ /* No translation, it may call malloc(). */
1098
1102
#ifdef SIGHASARG
1099
- sprintf ((char * )IObuff , _ ( "Vim: Caught deadly signal %s\n" ) ,
1103
+ sprintf ((char * )IObuff , "Vim: Caught deadly signal %s\n" ,
1100
1104
signal_info [i ].name );
1101
1105
#else
1102
- sprintf ((char * )IObuff , _ ( "Vim: Caught deadly signal\n" ) );
1106
+ sprintf ((char * )IObuff , "Vim: Caught deadly signal\n" );
1103
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
1113
#ifdef NBDEBUG
1107
1114
reset_signals ();
Original file line number Diff line number Diff line change @@ -738,6 +738,8 @@ static char *(features[]) =
738
738
739
739
static int included_patches [] =
740
740
{ /* Add new patch number below this line */
741
+ /**/
742
+ 22 ,
741
743
/**/
742
744
21 ,
743
745
/**/
You can’t perform that action at this time.
0 commit comments