]> git.sesse.net Git - vlc/blobdiff - src/vlc.c
Fix memleaks (use vlclua_dir_list_free).
[vlc] / src / vlc.c
index 3f17c3ad1e9eac2ead3677851f2cb0be6d5b9fc4..2ede9433e4b67ff029654d1266ec13cec7cb9369 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
@@ -51,6 +51,15 @@ int main( int i_argc, const char *ppsz_argv[] )
 {
     int i_ret;
 
+    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"
+        "cannot be run by non-trusted users first).\n", ppsz_argv[0]);
+        return 1;
+    }
+
     setlocale (LC_ALL, "");
 
 #ifndef __APPLE__
@@ -115,8 +124,9 @@ int main( int i_argc, const char *ppsz_argv[] )
         if ((ppsz_argv[i] = FromLocale (ppsz_argv[i])) == NULL)
             return 1; // BOOM!
 
-    libvlc_exception_t ex;
+    libvlc_exception_t ex, dummy;
     libvlc_exception_init (&ex);
+    libvlc_exception_init (&dummy);
 
     /* Initialize libvlc */
     int i_argc_real = i_argc ? i_argc - 1 : 0;
@@ -125,9 +135,9 @@ int main( int i_argc, const char *ppsz_argv[] )
 
     if (vlc != NULL)
     {
-        libvlc_add_intf (vlc, "signals", NULL);
+        libvlc_add_intf (vlc, "signals", &dummy);
         libvlc_add_intf (vlc, NULL, &ex);
-        libvlc_playlist_play (vlc, -1, 0, NULL, NULL);
+        libvlc_playlist_play (vlc, -1, 0, NULL, &dummy);
         libvlc_wait (vlc);
         libvlc_release (vlc);
     }
@@ -136,6 +146,7 @@ int main( int i_argc, const char *ppsz_argv[] )
         fprintf( stderr, "%s\n", libvlc_exception_get_message( &ex));
 
     libvlc_exception_clear (&ex);
+    libvlc_exception_clear (&dummy);
 
     for (int i = 0; i < i_argc; i++)
         LocaleFree (ppsz_argv[i]);