+ * Creates a new transport for the given binary and arguments. This
+ * creates a client-side of a transport. The process will be forked
+ * off and executed with stdin/stdout connected to a local AF_UNIX
+ * socket.
+ *
+ * @param path the path to the domain socket.
+ * @param argv Parameters list
+ * @param error address where an error can be returned.
+ * @returns a new transport, or #NULL on failure.
+ */
+static DBusTransport*
+_dbus_transport_new_for_exec (const char *path,
+ char *const argv[],
+ DBusError *error)
+{
+ int fd;
+ DBusTransport *transport;
+ DBusString address;
+ unsigned i;
+ char *escaped;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ if (!_dbus_string_init (&address))
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ return NULL;
+ }
+
+ fd = -1;
+
+ escaped = dbus_address_escape_value (path);
+ if (!escaped)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed;
+ }
+
+ if (!_dbus_string_append (&address, "unixexec:path=") ||
+ !_dbus_string_append (&address, escaped))
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ dbus_free (escaped);
+ goto failed;
+ }
+
+ dbus_free (escaped);
+
+ if (argv)
+ {
+ for (i = 0; argv[i]; i++)
+ {
+ dbus_bool_t success;
+
+ escaped = dbus_address_escape_value (argv[i]);
+ if (!escaped)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed;
+ }
+
+ success = _dbus_string_append_printf (&address, ",argv%u=%s", i, escaped);
+ dbus_free (escaped);
+
+ if (!success)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed;
+ }
+ }
+ }
+
+ fd = _dbus_connect_exec (path, argv, error);
+ if (fd < 0)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ goto failed;
+ }
+
+ _dbus_verbose ("Successfully connected to process %s\n",
+ path);
+
+ transport = _dbus_transport_new_for_socket (fd, NULL, &address);
+ if (transport == NULL)
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed;
+ }
+
+ _dbus_string_free (&address);
+
+ return transport;
+
+ failed:
+ if (fd >= 0)
+ _dbus_close_socket (fd, NULL);
+
+ _dbus_string_free (&address);
+ return NULL;
+}
+
+/**