• Devin Hussey's avatar
    signals: upon a crash, save changed buffers and reset terminal state · e889c28a
    Devin Hussey authored
    Upon a segmentation fault or an abort signal, instead of crashing,
    losing all changes, and leaving the terminal in curses mode, nano
    now calls die(), to save any changed buffers and to restore the
    terminal to a usable state.
    
    For the remote chance that nano segfaults in die(), the handler for
    SIGSEGV and for SIGABRT is reset to its default value as soon as the
    signal fires, to prevent a crash-handler loop.
    
    Since a core dump is usually more helpful for debugging, the crash
    handler is not included in a debug build.
    
    This addresses https://savannah.gnu.org/patch/?9623
    
    .
    Signed-off-by: default avatarDevin Hussey <husseydevin@gmail.com>
    e889c28a
nano.c 71.7 KB