summaryrefslogtreecommitdiffstats
path: root/tools/dbus-launch-x11.c
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2006-10-26 17:34:49 +0000
committerThiago Macieira <thiago@kde.org>2006-10-26 17:34:49 +0000
commit01b91ba121034f94c1e4d4511b9e61f622dde48c (patch)
treef754ee026ce574ba3df2cf47db3215655a199d4e /tools/dbus-launch-x11.c
parenta107da84891f941d591bcaa99641f4058f089c7d (diff)
* tools/dbus-launch-x11.c (get_session_file, init_x_atoms):
check if get_machine_uuid() returns NULL before proceeding any further: we can't init the X atoms or create a session file name if there is no machine ID. This solves a crash reported by some users if --exit-with-session was used without --autolaunch=<machine-id>
Diffstat (limited to 'tools/dbus-launch-x11.c')
-rw-r--r--tools/dbus-launch-x11.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/dbus-launch-x11.c b/tools/dbus-launch-x11.c
index f0588ad8..b7d1c208 100644
--- a/tools/dbus-launch-x11.c
+++ b/tools/dbus-launch-x11.c
@@ -98,6 +98,10 @@ get_session_file (void)
char *result;
char *p;
+ machine = get_machine_uuid ();
+ if (machine == NULL)
+ return NULL;
+
display = xstrdup (getenv ("DISPLAY"));
if (display == NULL)
{
@@ -143,8 +147,6 @@ get_session_file (void)
*p = '_';
}
- machine = get_machine_uuid ();
-
home = get_homedir ();
result = malloc (strlen (home) + strlen (prefix) + strlen (machine) +
@@ -237,6 +239,10 @@ init_x_atoms (Display *display)
if (init)
return TRUE;
+ machine = get_machine_uuid ();
+ if (machine == NULL)
+ return FALSE;
+
user = getpwuid (getuid ());
if (user == NULL)
{
@@ -245,8 +251,6 @@ init_x_atoms (Display *display)
}
user_name = xstrdup(user->pw_name);
- machine = get_machine_uuid ();
-
atom_name = malloc (strlen (machine) + strlen (user_name) + 2 +
MAX (strlen (selection_prefix),
MAX (strlen (address_prefix),