summary refs log tree commit diff
path: root/libnm/nm-dbus-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm/nm-dbus-helpers.c')
-rw-r--r--libnm/nm-dbus-helpers.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libnm/nm-dbus-helpers.c b/libnm/nm-dbus-helpers.c
index 6bfd4bbd..45e09442 100644
--- a/libnm/nm-dbus-helpers.c
+++ b/libnm/nm-dbus-helpers.c
@@ -22,6 +22,8 @@
 
 #include <string.h>
 #include <gio/gio.h>
+
+#include "nm-glib-compat.h"
 #include "nm-dbus-helpers.h"
 #include "nm-dbus-interface.h"
 
@@ -93,7 +95,8 @@ _nm_dbus_new_connection (GCancellable *cancellable, GError **error)
 	GDBusConnection *connection = NULL;
 
 	/* If running as root try the private bus first */
-	if (0 == geteuid ()) {
+	if (0 == geteuid () && !g_test_initialized ()) {
+
 		GError *local = NULL;
 		GDBusConnection *p;
 
@@ -203,7 +206,7 @@ _nm_dbus_new_connection_async (GCancellable *cancellable,
 	simple = g_simple_async_result_new (NULL, callback, user_data, _nm_dbus_new_connection_async);
 
 	/* If running as root try the private bus first */
-	if (0 == geteuid ()) {
+	if (0 == geteuid () && !g_test_initialized ()) {
 		GDBusConnection *p;
 
 		if (cancellable) {