X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bin%2Fvlc.c;h=085aa3afda453b37dd9cf8422b42c05b5c55c5b3;hb=d09772f846f9250d7a1f04e58a48be8a76d8ece3;hp=ef3a4b511e7ec3db1b57d38516f9d1fa02ecde4a;hpb=d3b02be6e47870bb1dff74f99bfa510fc4140646;p=vlc diff --git a/bin/vlc.c b/bin/vlc.c index ef3a4b511e..085aa3afda 100644 --- a/bin/vlc.c +++ b/bin/vlc.c @@ -74,6 +74,11 @@ static void vlc_kill (void *data) pthread_kill (*ps, SIGTERM); } +static void exit_timeout (int signum) +{ + (void) signum; + signal (SIGINT, SIG_DFL); +} /***************************************************************************** * main: parse command line, start interface and spawn threads. @@ -198,6 +203,8 @@ int main( int i_argc, const char *ppsz_argv[] ) if (vlc == NULL) goto out; + libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION); + #if !defined (HAVE_MAEMO) && !defined __APPLE__ libvlc_add_intf (vlc, "globalhotkeys,none"); #endif @@ -219,6 +226,15 @@ int main( int i_argc, const char *ppsz_argv[] ) sigwait (&set, &signum); while (signum == SIGCHLD); + /* Restore default signal behaviour after 3 seconds */ + sigemptyset (&set); + sigaddset (&set, SIGINT); + sigaddset (&set, SIGALRM); + signal (SIGINT, SIG_IGN); + signal (SIGALRM, exit_timeout); + pthread_sigmask (SIG_UNBLOCK, &set, NULL); + alarm (3); + /* Cleanup */ out: if (vlc != NULL) @@ -226,15 +242,8 @@ out: for (int i = 1; i < argc; i++) LocaleFree (argv[i]); -#ifdef RTLD_NOLOAD - /* Avoid crash in KIO scheduler cleanup. */ - /* This is ugly, but we get way too many crash reports due to this. */ - if (dlopen ("libkio.so.5", RTLD_LAZY|RTLD_LOCAL|RTLD_NOLOAD) != NULL) - { - fprintf (stderr, "KIO present. Unclean shutdown!\n" - " (see http://bugs.kde.org/show_bug.cgi?id=234484 for details)\n"); - _exit (0); - } -#endif - return 0; + /* Do not run exit handlers. Some of them are buggy (e.g. KDE IO scheduler) + * and crash. Also some will crash because their library may be already + * unloaded (dlclose()). */ + _exit (0); }