Fix a crash that sometimes occurs on Linux when interrupting from
the terminal a simulation that was started directly from the command line. A gdb backtrace showed rl_cleanup_after_signal() calling fwrite() with a NULL file pointer.
This commit is contained in:
parent
69bb426cdb
commit
8775376723
41
src/main.c
41
src/main.c
|
|
@ -593,18 +593,12 @@ app_event_func(void)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* Initialisation for readline. */
|
||||||
/* This is the command processing loop for spice and nutmeg.
|
|
||||||
The function is called even when GNU readline is unavailable, in which
|
|
||||||
case it falls back to repeatable calling cp_evloop()
|
|
||||||
SJB 26th April 2005 */
|
|
||||||
static void
|
static void
|
||||||
app_rl_readlines(void)
|
app_rl_init(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
||||||
/* GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
|
|
||||||
char *line, *expanded_line;
|
|
||||||
|
|
||||||
/* --- set up readline params --- */
|
/* --- set up readline params --- */
|
||||||
strcpy(history_file, getenv("HOME"));
|
strcpy(history_file, getenv("HOME"));
|
||||||
strcat(history_file, "/.");
|
strcat(history_file, "/.");
|
||||||
|
|
@ -617,10 +611,6 @@ app_rl_readlines(void)
|
||||||
rl_readline_name = application_name;
|
rl_readline_name = application_name;
|
||||||
rl_instream = cp_in;
|
rl_instream = cp_in;
|
||||||
rl_outstream = cp_out;
|
rl_outstream = cp_out;
|
||||||
#ifndef X_DISPLAY_MISSING
|
|
||||||
if (dispdev->Input == X11_Input)
|
|
||||||
rl_event_hook = app_event_func;
|
|
||||||
#endif
|
|
||||||
rl_catch_signals = 0; /* disable signal handling */
|
rl_catch_signals = 0; /* disable signal handling */
|
||||||
|
|
||||||
/* sjb - what to do for editline?
|
/* sjb - what to do for editline?
|
||||||
|
|
@ -628,6 +618,25 @@ app_rl_readlines(void)
|
||||||
#if defined(HAVE_GNUREADLINE)
|
#if defined(HAVE_GNUREADLINE)
|
||||||
rl_catch_sigwinch = 1; /* allow readline to respond to resized windows */
|
rl_catch_sigwinch = 1; /* allow readline to respond to resized windows */
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* This is the command processing loop for spice and nutmeg.
|
||||||
|
The function is called even when GNU readline is unavailable, in which
|
||||||
|
case it falls back to repeatable calling cp_evloop()
|
||||||
|
SJB 26th April 2005 */
|
||||||
|
static void
|
||||||
|
app_rl_readlines(void)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
||||||
|
/* GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
|
||||||
|
char *line, *expanded_line;
|
||||||
|
|
||||||
|
#ifndef X_DISPLAY_MISSING
|
||||||
|
if (dispdev->Input == X11_Input)
|
||||||
|
rl_event_hook = app_event_func;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* note that we want some mechanism to detect ctrl-D and expand it to exit */
|
/* note that we want some mechanism to detect ctrl-D and expand it to exit */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -1151,7 +1160,11 @@ int main(int argc, char **argv)
|
||||||
fprintf(stdout, "We are ready to read initialization files.\n");
|
fprintf(stdout, "We are ready to read initialization files.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* To catch interrupts during .spiceinit... */
|
/* To catch interrupts during .spiceinit... Readline must be initialised
|
||||||
|
* so that it is safe to call ft_sigintr_cleanup();
|
||||||
|
*/
|
||||||
|
|
||||||
|
app_rl_init();
|
||||||
if (SETJMP(jbuf, 1)) {
|
if (SETJMP(jbuf, 1)) {
|
||||||
ft_sigintr_cleanup();
|
ft_sigintr_cleanup();
|
||||||
fprintf(cp_err, "Warning: error executing .spiceinit.\n");
|
fprintf(cp_err, "Warning: error executing .spiceinit.\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue