X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fvlc.c;h=2ede9433e4b67ff029654d1266ec13cec7cb9369;hb=6a66117a34f627ad9560b07cead07663b48f23b6;hp=12833b79fcd74a00732d6e8b410e09190cdd4f17;hpb=952d118d97d168123b947cf8edcbc3a0360f0d9b;p=vlc diff --git a/src/vlc.c b/src/vlc.c index 12833b79fc..2ede9433e4 100644 --- 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,8 +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, &dummy); libvlc_wait (vlc); libvlc_release (vlc); } @@ -135,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]);