]> git.sesse.net Git - vlc/blobdiff - bin/vlc.c
Win32: fix crash reporting version string
[vlc] / bin / vlc.c
index 2ede9433e4b67ff029654d1266ec13cec7cb9369..ba3b040a8fc5c31f6fe097993a090bc90b58b5ac 100644 (file)
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -51,14 +51,16 @@ int main( int i_argc, const char *ppsz_argv[] )
 {
     int i_ret;
 
+#ifndef ALLOW_RUN_AS_ROOT
     if (geteuid () == 0)
     {
         fprintf (stderr, "VLC is not supposed to be run as root. Sorry.\n"
         "If you need to use real-time priorities and/or privileged TCP ports\n"
-        "you can use %s-wrapper (make sure it is Set-UID root first and\n"
+        "you can use %s-wrapper (make sure it is Set-UID root and\n"
         "cannot be run by non-trusted users first).\n", ppsz_argv[0]);
         return 1;
     }
+#endif
 
     setlocale (LC_ALL, "");
 
@@ -80,10 +82,6 @@ int main( int i_argc, const char *ppsz_argv[] )
 #   endif
 #endif
 
-#if defined (HAVE_GETEUID) && !defined (SYS_BEOS)
-    /* FIXME: rootwrap (); */
-#endif
-
     /* Synchronously intercepted POSIX signals.
      *
      * In a threaded program such as VLC, the only sane way to handle signals
@@ -104,8 +102,8 @@ int main( int i_argc, const char *ppsz_argv[] )
         SIGINT, SIGHUP, SIGQUIT, SIGTERM,
     /* Signals that cause a no-op:
      * - SIGPIPE might happen with sockets and would crash VLC. It MUST be
-     *   blocked by any LibVLC-dependent application, in addition to VLC.
-     * - SIGCHLD is comes after exec*() (such as httpd CGI support) and must
+     *   blocked by any LibVLC-dependent application, not just VLC.
+     * - SIGCHLD comes after exec*() (such as httpd CGI support) and must
      *   be dequeued to cleanup zombie processes.
      */
         SIGPIPE, SIGCHLD
@@ -118,6 +116,8 @@ int main( int i_argc, const char *ppsz_argv[] )
 
     /* Block all these signals */
     pthread_sigmask (SIG_BLOCK, &set, NULL);
+    sigdelset (&set, SIGPIPE);
+    sigdelset (&set, SIGCHLD);
 
     /* Note that FromLocale() can be used before libvlc is initialized */
     for (int i = 0; i < i_argc; i++)
@@ -135,7 +135,12 @@ int main( int i_argc, const char *ppsz_argv[] )
 
     if (vlc != NULL)
     {
-        libvlc_add_intf (vlc, "signals", &dummy);
+        libvlc_add_intf (vlc, "signals", &ex);
+        if (libvlc_exception_raised (&ex))
+        {
+            libvlc_exception_clear (&ex);
+            pthread_sigmask (SIG_UNBLOCK, &set, NULL);
+        }
         libvlc_add_intf (vlc, NULL, &ex);
         libvlc_playlist_play (vlc, -1, 0, NULL, &dummy);
         libvlc_wait (vlc);