diff options
author | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-09-09 19:24:12 +0000 |
---|---|---|
committer | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-09-09 19:24:12 +0000 |
commit | f50e3682eb4b99378e3bf1704e556bd14d94d657 (patch) | |
tree | 5d0e4fbe225289e655262764693d0d7eddba4286 /mplayer.c | |
parent | 2e6733cb05ae68268219da130ebb0b6d6d4ee505 (diff) | |
download | mpv-f50e3682eb4b99378e3bf1704e556bd14d94d657.tar.bz2 mpv-f50e3682eb4b99378e3bf1704e556bd14d94d657.tar.xz |
Don't leave a messed up terminal after a crash
Old way:
crash: try uninit + exit (4 times)
crash: try exit(1)
crash: send self kill -9
With this patch:
crash: try uninit + exit (4 times)
crash: forget about the normal mplayer uninit codepaths and try
restore terminal by force + exit
crash: try exit
crash: send self kill -9
Patch by Jan Knutar ( jknutar at nic dot fi )
Approved by alex
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13299 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -490,8 +490,18 @@ void exit_player(char* how){ static void exit_sighandler(int x){ static int sig_count=0; ++sig_count; - if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1); - if(sig_count>5){ + if(inited_flags==0 && sig_count>1) exit(1); + if(sig_count==5) + { + /* We're crashing bad and can't uninit cleanly :( + * by popular request, we make one last (dirty) + * effort to restore the user's + * terminal. */ + getch2_disable(); + exit(1); + } + if(sig_count==6) exit(1); + if(sig_count>6){ // can't stop :( #ifndef __MINGW32__ kill(getpid(),SIGKILL); |