dbus/dbus dbus-sysdeps-unix.c,1.8,1.9
Havoc Pennington
hp at kemper.freedesktop.org
Sun Oct 1 13:05:41 PDT 2006
- Previous message: dbus ChangeLog,1.1135,1.1136
- Next message: dbus/tools Makefile.am, 1.24, 1.25 dbus-launch-x11.c, 1.2,
1.3 dbus-launch.1, 1.7, 1.8 dbus-launch.c, 1.18,
1.19 dbus-launch.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv6139/dbus
Modified Files:
dbus-sysdeps-unix.c
Log Message:
2006-10-01 Havoc Pennington <hp at redhat.com>
* tools/dbus-launch.c (print_variables): if no syntax is given,
don't print something that's sort-of-half-sh-syntax, just print
a plain key-value pairs thing.
* tools/dbus-launch-x11.c: use machine ID rather than hostname for
the local machine representation (but still have the hostname in
the display). Remove the hostname from the display if it is
localhost. Change session files to be named
~/.dbus/session-bus/machine-display. Change X atoms to be
underscore-prefixed so nobody whines about ICCCM compliance.
Otherwise name them the same as the env variables.
Change session file format to include key-value pairs and an
explanatory comment. Keys are the same as the env variables.
(set_address_in_x11): X property format can't depend on
sizeof(pid_t) on a particular machine, fix to always be 32 bits
* tools/dbus-launch.c: make --autolaunch take a machine id
argument. If --autolaunch is used with a program to run, complain
for now (but add a FIXME). Also, don't look for existing bus if
there's a program to run (but add a FIXME).
* dbus/dbus-sysdeps-unix.c (_dbus_get_autolaunch_address): pass
machine uuid to dbus-launch (avoids linking dbus-launch to libdbus
just to get this, and avoids duplicating uuid-reading code).
* tools/dbus-launch.1: clarify various things
Index: dbus-sysdeps-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-unix.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbus-sysdeps-unix.c 1 Oct 2006 15:36:18 -0000 1.8
+++ dbus-sysdeps-unix.c 1 Oct 2006 20:05:39 -0000 1.9
@@ -2293,18 +2293,44 @@
* @returns #TRUE on success, #FALSE if an error happened
*/
dbus_bool_t
-_dbus_get_autolaunch_address (DBusString *address, DBusError *error)
+_dbus_get_autolaunch_address (DBusString *address,
+ DBusError *error)
{
- static char *argv[] = { DBUS_BINDIR "/dbus-launch", "--autolaunch",
- "--binary-syntax", NULL };
+ static char *argv[5];
int address_pipe[2];
pid_t pid;
int ret;
int status;
int orig_len;
-
+ int i;
+ DBusString uuid;
+ dbus_bool_t retval;
+
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ retval = FALSE;
+
+ _dbus_string_init (&uuid);
+
+ if (!_dbus_get_local_machine_uuid_encoded (&uuid))
+ {
+ _DBUS_SET_OOM (error);
+ goto out;
+ }
+
+ i = 0;
+ argv[i] = DBUS_BINDIR "/dbus-launch";
+ ++i;
+ argv[i] = "--autolaunch";
+ ++i;
+ argv[i] = _dbus_string_get_const_data (&uuid);
+ ++i;
+ argv[i] = "--binary-syntax";
+ ++i;
+ argv[i] = NULL;
+ ++i;
+ _dbus_assert (i == _DBUS_N_ELEMENTS (argv));
+
orig_len = _dbus_string_get_length (address);
#define READ_END 0
@@ -2316,7 +2342,7 @@
_dbus_strerror (errno));
_dbus_verbose ("Failed to create a pipe to call dbus-launch: %s\n",
_dbus_strerror (errno));
- return FALSE;
+ goto out;
}
pid = fork ();
@@ -2327,7 +2353,7 @@
_dbus_strerror (errno));
_dbus_verbose ("Failed to fork() to call dbus-launch: %s\n",
_dbus_strerror (errno));
- return FALSE;
+ goto out;
}
if (pid == 0)
@@ -2389,9 +2415,19 @@
_dbus_string_set_length (address, orig_len);
dbus_set_error (error, DBUS_ERROR_SPAWN_EXEC_FAILED,
"Failed to execute dbus-launch to autolaunch D-Bus session");
- return FALSE;
+ goto out;
}
- return TRUE;
+
+ retval = TRUE;
+
+ out:
+ if (retval)
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ else
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+
+ _dbus_string_free (&uuid);
+ return retval;
}
/**
- Previous message: dbus ChangeLog,1.1135,1.1136
- Next message: dbus/tools Makefile.am, 1.24, 1.25 dbus-launch-x11.c, 1.2,
1.3 dbus-launch.1, 1.7, 1.8 dbus-launch.c, 1.18,
1.19 dbus-launch.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dbus-commit
mailing list