-#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);
- }
+ /* Qt4 insists on catching SIGCHLD via signal handler. To work around that,
+ * unblock it after all our child threads are created. */
+ sigdelset (&set, SIGCHLD);
+ pthread_sigmask (SIG_SETMASK, &set, NULL);
+
+ /* Do not dequeue SIGHUP if it is ignored (nohup) */
+ if (signal_ignored (SIGHUP))
+ sigdelset (&set, SIGHUP);
+ /* Ignore SIGPIPE */
+ sigdelset (&set, SIGPIPE);
+
+ int signum;
+ sigwait (&set, &signum);
+
+ /* 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);
+
+ ret = 0;
+ /* Cleanup */
+out:
+ libvlc_release (vlc);
+#ifdef __OS2__
+ for (int i = 2; i < argc; i++)
+ free (argv[i]);