[vlc-commits] dbus: remove silly configuration option regarding unique name
Rémi Denis-Courmont
git at videolan.org
Mon Feb 6 21:43:24 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb 6 22:41:34 2012 +0200| [daf9bb252d940d3194d74620a127a8d0df7c81d2] | committer: Rémi Denis-Courmont
dbus: remove silly configuration option regarding unique name
Register both names unique and not. Fail if the unique name cannot be
obtained.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=daf9bb252d940d3194d74620a127a8d0df7c81d2
---
modules/control/dbus/dbus.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 7166e8f..de27207 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -178,13 +178,6 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- char psz_service_name[sizeof(DBUS_MPRIS_BUS_NAME) + 12];
- if( var_InheritBool( p_intf, "dbus-unique-service-id" ) )
- snprintf( psz_service_name, sizeof( psz_service_name ),
- DBUS_MPRIS_BUS_NAME"-%d", getpid() );
- else
- strcpy( psz_service_name, DBUS_MPRIS_BUS_NAME );
-
DBusError error;
dbus_error_init( &error );
@@ -204,16 +197,21 @@ static int Open( vlc_object_t *p_this )
dbus_connection_set_exit_on_disconnect( p_conn, FALSE );
/* register a well-known name on the bus */
- dbus_bus_request_name( p_conn, psz_service_name, 0, &error );
+ char unique_service[sizeof (DBUS_MPRIS_BUS_NAME) + 10];
+ snprintf( unique_service, sizeof (unique_service),
+ DBUS_MPRIS_BUS_NAME"-%"PRIu32, (uint32_t)getpid() );
+ dbus_bus_request_name( p_conn, unique_service, 0, &error );
if( dbus_error_is_set( &error ) )
{
- msg_Err( p_this, "Error requesting service %s: %s",
- psz_service_name, error.message );
+ msg_Err( p_this, "Error requesting service name %s: %s",
+ unique_service, error.message );
dbus_error_free( &error );
free( p_sys );
return VLC_EGENERIC;
}
- msg_Info( p_intf, "listening on dbus as: %s", psz_service_name );
+ msg_Info( p_intf, "listening on dbus as: %s", unique_service );
+
+ dbus_bus_request_name( p_conn, DBUS_MPRIS_BUS_NAME, 0, NULL );
/* Register the entry point object path */
dbus_connection_register_object_path( p_conn, DBUS_MPRIS_OBJECT_PATH,
More information about the vlc-commits
mailing list