summaryrefslogtreecommitdiff
path: root/tools/tool-common.c
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2021-11-11 10:01:29 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2021-11-23 08:38:14 +0100
commit79df3d2811343eadcf2f95bacb372729fde1fddd (patch)
tree3c6c3a97b474e79db7903071fb1553a343eb075d /tools/tool-common.c
parent3f7c36f4b1d290eeb115921820ba945fc467cad3 (diff)
downloaddbus-79df3d2811343eadcf2f95bacb372729fde1fddd.tar.gz
tools/dbus-run-session: fix race between manual and automatically started dbus-daemon on Windows
dbus-run-session starts a dbus-daemon before the client application. We must avoid letting the application try to connect before the dbus-daemon's DBusServer is listening for connections. In the Unix implementation, we already achieved this via the --print-address option. If the client tried to connect too soon, the server would not yet be listening and the client would fail. In the Windows implementation, we communicate the bus address to the client application as an autolaunch: address, so if the client tried to connect too soon, it would autolaunch a new dbus-daemon instead of using the one that it was intended to use. We can avoid this by using a new option to pass in a Windows event object, which will be set when the server has started and is ready to process connections. Fixes #297
Diffstat (limited to 'tools/tool-common.c')
-rw-r--r--tools/tool-common.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/tool-common.c b/tools/tool-common.c
index 32020324..4fcfcb9f 100644
--- a/tools/tool-common.c
+++ b/tools/tool-common.c
@@ -80,3 +80,10 @@ tool_write_all (int fd,
return TRUE;
}
+
+void
+tool_stderr_error (const char *context,
+ DBusError *error)
+{
+ fprintf (stderr, "%s: %s: %s\n", context, error->name, error->message);
+}