X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fvlc.c;h=2ede9433e4b67ff029654d1266ec13cec7cb9369;hb=688f0a8d8913f20ac5d3e27bf4f2bbe35c9f5de7;hp=45a603481f741dca4a1864146fc1fe7a4effbe06;hpb=a8f72d056fc842e3d338971ebf2a7511c59855a5;p=vlc diff --git a/src/vlc.c b/src/vlc.c index 45a603481f..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,13 +135,18 @@ 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); } i_ret = libvlc_exception_raised (&ex); + if( i_ret ) + 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]);