diff options
author | Brian Cameron <brian.cameron@sun.com> | 2008-01-28 17:30:47 -0500 |
---|---|---|
committer | William Jon McCann <mccann@jhu.edu> | 2008-01-28 17:30:47 -0500 |
commit | 96d613ee9a4850753e8f93113ab28ed3045f73f3 (patch) | |
tree | 48a4462c40fe543a1afa0813868afed50b593311 | |
parent | 9aca4062ec226c8099b5d46467ad72792e9977dc (diff) | |
download | ConsoleKit2-96d613ee9a4850753e8f93113ab28ed3045f73f3.tar.gz |
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.
-rw-r--r-- | src/ck-session.c | 3 | ||||
-rw-r--r-- | 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]), |