2006-01-20 Robert Love <rml@novell.com>

* src/NetworkManagerDbus.c: Fail if NM's DBUS service is already taken,
	  instead of queuing.  This prevents the running of multiple NM
	  daemons concurrently, which does not work whatsoever and results in
	  neither daemon working correctly.  Also, we don't handle queuing and
	  name-owner-changes, anyhow.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1364 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love
2006-01-20 17:03:13 +00:00
committed by Robert Love
parent 1dda3e4490
commit 0b977b258f
2 changed files with 20 additions and 5 deletions

View File

@@ -1,3 +1,11 @@
2006-01-20 Robert Love <rml@novell.com>
* src/NetworkManagerDbus.c: Fail if NM's DBUS service is already taken,
instead of queuing. This prevents the running of multiple NM
daemons concurrently, which does not work whatsoever and results in
neither daemon working correctly. Also, we don't handle queuing and
name-owner-changes, anyhow.
2006-01-20 Robert Love <rml@novell.com> 2006-01-20 Robert Love <rml@novell.com>
* src/Makefile.am: Install the NetworkManager daemon to sbin, not bin. * src/Makefile.am: Install the NetworkManager daemon to sbin, not bin.

View File

@@ -749,7 +749,7 @@ DBusConnection *nm_dbus_init (NMData *data)
DBusObjectPathVTable devices_vtable = {NULL, &nm_dbus_devices_message_handler, NULL, NULL, NULL, NULL}; DBusObjectPathVTable devices_vtable = {NULL, &nm_dbus_devices_message_handler, NULL, NULL, NULL, NULL};
DBusObjectPathVTable vpn_vtable = {NULL, &nm_dbus_vpn_message_handler, NULL, NULL, NULL, NULL}; DBusObjectPathVTable vpn_vtable = {NULL, &nm_dbus_vpn_message_handler, NULL, NULL, NULL, NULL};
char * owner; char * owner;
int flags = 0; int flags, ret;
dbus_connection_set_change_sigpipe (TRUE); dbus_connection_set_change_sigpipe (TRUE);
@@ -762,7 +762,7 @@ DBusConnection *nm_dbus_init (NMData *data)
goto out; goto out;
} }
// dbus_connection_set_exit_on_disconnect (connection, FALSE); //dbus_connection_set_exit_on_disconnect (connection, FALSE);
dbus_connection_setup_with_g_main (connection, data->main_context); dbus_connection_setup_with_g_main (connection, data->main_context);
data->nm_methods = nm_dbus_nm_methods_setup (); data->nm_methods = nm_dbus_nm_methods_setup ();
@@ -803,17 +803,24 @@ DBusConnection *nm_dbus_init (NMData *data)
dbus_error_init (&error); dbus_error_init (&error);
#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 60) #if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 60)
flags = 0; /* Prohibit replacement */ flags = DBUS_NAME_FLAG_DO_NOT_QUEUE; /* Prohibit replacement is now the default */
#else #else
flags &= DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT; flags = DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT;
#endif #endif
dbus_bus_request_name (connection, NM_DBUS_SERVICE, flags, &error); ret = dbus_bus_request_name (connection, NM_DBUS_SERVICE, flags, &error);
if (dbus_error_is_set (&error)) if (dbus_error_is_set (&error))
{ {
nm_warning ("nm_dbus_init() could not acquire the NetworkManager service.\n Message: '%s'", error.message); nm_warning ("nm_dbus_init() could not acquire the NetworkManager service.\n Message: '%s'", error.message);
connection = NULL; connection = NULL;
goto out; goto out;
} }
else if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
{
nm_warning ("nm_dbus_init() could not acquire the NetworkManager service as it is already taken (ret=%d). Is the daemon already running?",
ret);
connection = NULL;
goto out;
}
out: out:
if (dbus_error_is_set (&error)) if (dbus_error_is_set (&error))