comparison mplayer.c @ 13298:a7bde33bd7d8

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
author rtognimp
date Thu, 09 Sep 2004 19:24:12 +0000
parents aa13937da8a0
children 1820ef597cdb
comparison
equal deleted inserted replaced
13297:0696c8037445 13298:a7bde33bd7d8
488 } 488 }
489 489
490 static void exit_sighandler(int x){ 490 static void exit_sighandler(int x){
491 static int sig_count=0; 491 static int sig_count=0;
492 ++sig_count; 492 ++sig_count;
493 if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1); 493 if(inited_flags==0 && sig_count>1) exit(1);
494 if(sig_count>5){ 494 if(sig_count==5)
495 {
496 /* We're crashing bad and can't uninit cleanly :(
497 * by popular request, we make one last (dirty)
498 * effort to restore the user's
499 * terminal. */
500 getch2_disable();
501 exit(1);
502 }
503 if(sig_count==6) exit(1);
504 if(sig_count>6){
495 // can't stop :( 505 // can't stop :(
496 #ifndef __MINGW32__ 506 #ifndef __MINGW32__
497 kill(getpid(),SIGKILL); 507 kill(getpid(),SIGKILL);
498 #endif 508 #endif
499 } 509 }