From 96d613ee9a4850753e8f93113ab28ed3045f73f3 Mon Sep 17 00:00:00 2001 From: Brian Cameron Date: Mon, 28 Jan 2008 17:30:47 -0500 Subject: fixes for solaris Fixes two bugs I found in the code. The first is that we need some NULL protection around the g_strdup_printf where we build CK_SESSION_X11_DISPLAY to avoid a crash. Second, I noticed a bug in the ck_unix_pid_get_hash function where we weren't parsing the data right and causing the hash to not get set properly. --- src/ck-session.c | 3 ++- src/ck-sysdeps-solaris.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ck-session.c b/src/ck-session.c index a700786..b950184 100644 --- a/src/ck-session.c +++ b/src/ck-session.c @@ -1230,7 +1230,8 @@ ck_session_run_programs (CkSession *session, if (session->priv->x11_display_device != NULL && strlen (session->priv->x11_display_device) > 0) { extra_env[n++] = g_strdup_printf ("CK_SESSION_X11_DISPLAY_DEVICE=%s", session->priv->x11_display_device); } - extra_env[n++] = g_strdup_printf ("CK_SESSION_X11_DISPLAY=%s", session->priv->x11_display); + extra_env[n++] = g_strdup_printf ("CK_SESSION_X11_DISPLAY=%s", + session->priv->x11_display ? session->priv->x11_display : ""); if (session->priv->remote_host_name != NULL && strlen (session->priv->remote_host_name) > 0) { extra_env[n++] = g_strdup_printf ("CK_SESSION_REMOTE_HOST_NAME=%s", session->priv->remote_host_name); } diff --git a/src/ck-sysdeps-solaris.c b/src/ck-sysdeps-solaris.c index c0f333e..adcb70c 100644 --- a/src/ck-sysdeps-solaris.c +++ b/src/ck-sysdeps-solaris.c @@ -260,7 +260,7 @@ ck_unix_pid_get_env_hash (pid_t pid) if (skip_prefix != NULL) { char **vals; - vals = g_strsplit (buf, "=", 2); + vals = g_strsplit (skip_prefix + 1, "=", 2); if (vals != NULL) { g_hash_table_insert (hash, g_strdup (vals[0]), -- cgit