[vlc-commits] Don't pass relative file paths when using --one-instance

Pierre Ynard git at videolan.org
Thu Jan 27 16:17:07 CET 2011


vlc/vlc-1.1 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Thu Jan 27 16:16:56 2011 +0100| [68d10077bf65114f62d37a557242a1729191202d] | committer: Pierre Ynard

Don't pass relative file paths when using --one-instance

Fixes Debian bug #600269

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=68d10077bf65114f62d37a557242a1729191202d
---

 src/libvlc.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index 4396d4b..73ca152 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -604,8 +604,12 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
                 for( i_input = vlc_optind; i_input < i_argc;i_input++ )
                 {
+                    /* We need to resolve relative paths in this instance */
+                    char *psz_mrl = make_URI( ppsz_argv[i_input] );
+                    if( psz_mrl == NULL )
+                        continue;
                     msg_Dbg( p_libvlc, "Adds %s to the running Media Player",
-                            ppsz_argv[i_input] );
+                             psz_mrl );
 
                     p_dbus_msg = dbus_message_new_method_call(
                             "org.mpris.vlc", "/TrackList",
@@ -614,6 +618,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
                     if ( NULL == p_dbus_msg )
                     {
                         msg_Err( p_libvlc, "D-Bus problem" );
+                        free( psz_mrl );
                         system_End( p_libvlc );
                         exit( 1 );
                     }
@@ -621,12 +626,14 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
                     /* append MRLs */
                     dbus_message_iter_init_append( p_dbus_msg, &dbus_args );
                     if ( !dbus_message_iter_append_basic( &dbus_args,
-                                DBUS_TYPE_STRING, &ppsz_argv[i_input] ) )
+                                DBUS_TYPE_STRING, &psz_mrl ) )
                     {
                         dbus_message_unref( p_dbus_msg );
+                        free( psz_mrl );
                         system_End( p_libvlc );
                         exit( 1 );
                     }
+                    free( psz_mrl );
                     b_play = TRUE;
                     if( var_InheritBool( p_libvlc, "playlist-enqueue" ) )
                         b_play = FALSE;



More information about the vlc-commits mailing list