packages: ConsoleKit/ConsoleKit.spec, ConsoleKit/ConsoleKit-git.patch (NEW)...

baggins baggins at pld-linux.org
Sun May 27 21:53:39 CEST 2012


Author: baggins                      Date: Sun May 27 19:53:39 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 11
- update from upstream git
- udev-acl now packaged, provided and obsoleted by ConsoleKit

---- Files affected:
packages/ConsoleKit:
   ConsoleKit.spec (1.49 -> 1.50) , ConsoleKit-git.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/ConsoleKit/ConsoleKit.spec
diff -u packages/ConsoleKit/ConsoleKit.spec:1.49 packages/ConsoleKit/ConsoleKit.spec:1.50
--- packages/ConsoleKit/ConsoleKit.spec:1.49	Tue Apr 17 19:07:55 2012
+++ packages/ConsoleKit/ConsoleKit.spec	Sun May 27 21:53:33 2012
@@ -3,19 +3,21 @@
 Summary(pl.UTF-8):	ConsoleKit dla PolicyKit
 Name:		ConsoleKit
 Version:	0.4.5
-Release:	10
+Release:	11
 License:	GPL v2+
 Group:		Libraries
 Source0:	http://www.freedesktop.org/software/ConsoleKit/dist/%{name}-%{version}.tar.bz2
 # Source0-md5:	f2657f93761206922d558471a936fbc3
 Source1:	%{name}.tmpfiles
+Patch0:		%{name}-git.patch
 URL:		http://www.freedesktop.org/wiki/Software/ConsoleKit
 BuildRequires:	dbus-glib-devel >= 0.82
 BuildRequires:	docbook-dtd412-xml
 BuildRequires:	gettext-devel
-BuildRequires:	glib2-devel >= 1:2.14.0
+BuildRequires:	glib2-devel >= 1:2.22.0
 # for <sys/inotify.h>
 BuildRequires:	glibc-devel >= 6:2.4
+BuildRequires:	udev-devel
 BuildRequires:	pam-devel >= 0.80
 BuildRequires:	pkgconfig
 BuildRequires:	polkit-devel >= 0.92
@@ -32,8 +34,9 @@
 Requires:	glib2 >= 1:2.14.0
 Requires:	rc-scripts >= 0.4.3.0
 Requires:	systemd-units >= 38
+Provides:	udev-acl
+Obsoletes:	udev-acl
 Obsoletes:	ConsoleKit-systemd
-Suggests:	udev-acl
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -114,8 +117,13 @@
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
+%{__libtoolize}
+%{__aclocal}
+%{__automake}
+%{__autoconf}
 %configure \
 	--disable-silent-rules \
 	--enable-docbook-docs \
@@ -123,7 +131,8 @@
 	--enable-static \
 	--with-pam-module-dir=/%{_lib}/security \
 	--with-pid-file=%{_localstatedir}/run/console-kit-daemon.pid \
-	--with-systemdsystemunitdir=%{systemdunitdir}
+	--with-systemdsystemunitdir=%{systemdunitdir} \
+	--enable-udev-acl
 
 %{__make} -j1
 
@@ -201,6 +210,10 @@
 %{systemdunitdir}/poweroff.target.wants/console-kit-log-system-stop.service
 %{systemdunitdir}/reboot.target.wants/console-kit-log-system-restart.service
 
+%attr(755,root,root) /lib/udev/udev-acl
+%attr(755,root,root) /usr/lib/ConsoleKit/run-seat.d/udev-acl.ck
+/lib/udev/rules.d/70-udev-acl.rules
+ 
 %files libs
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libck-connector.so.*.*.*
@@ -243,6 +256,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.50  2012/05/27 19:53:33  baggins
+- rel 11
+- update from upstream git
+- udev-acl now packaged, provided and obsoleted by ConsoleKit
+
 Revision 1.49  2012/04/17 17:07:55  baggins
 - rel 10
 - better systemd deps

================================================================
Index: packages/ConsoleKit/ConsoleKit-git.patch
diff -u /dev/null packages/ConsoleKit/ConsoleKit-git.patch:1.1
--- /dev/null	Sun May 27 21:53:39 2012
+++ packages/ConsoleKit/ConsoleKit-git.patch	Sun May 27 21:53:33 2012
@@ -0,0 +1,1279 @@
+diff --git a/NEWS b/NEWS
+index 81c3225..cf06a31 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,4 +1,11 @@
+ ==============
++Version 0.4.5
++==============
++
++ * Loop around opening /dev/console to deal with BKL-less kernels (Colin Watson)
++ * systemd fixes (Lennart Poettering)
++
++==============
+ Version 0.4.4
+ ==============
+ 
+diff --git a/configure.ac b/configure.ac
+index 0efc489..7a3b33f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,7 +1,7 @@
+ 
+-AC_PREREQ(2.59c)
++AC_PREREQ([2.68])
+ AC_INIT([ConsoleKit],
+-        [0.4.5],
++        [0.4.6],
+         [https://bugs.freedesktop.org/enter_bug.cgi?product=ConsoleKit],
+         [ConsoleKit])
+ 
+@@ -12,13 +12,14 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+ AM_MAINTAINER_MODE
+ 
+ # for O_NOFOLLOW support
+-AC_GNU_SOURCE
++AC_USE_SYSTEM_EXTENSIONS
+ 
+-AC_ISC_POSIX
++AC_SEARCH_LIBS([strerror],[cposix])
+ AC_PROG_CC
+-AC_STDC_HEADERS
++AM_PROG_CC_C_O
++AC_HEADER_STDC
+ AC_DISABLE_STATIC
+-AC_PROG_LIBTOOL
++LT_INIT
+ 
+ AC_HEADER_STDC
+ 
+@@ -88,50 +89,15 @@ case "$host" in
+ 	;;
+ esac
+ 
+-# Find out the version of DBUS we're using
+-
+-dbus_version=`pkg-config --modversion dbus-1`
+-DBUS_VERSION_MAJOR=`echo $dbus_version | awk -F. '{print $1}'`
+-DBUS_VERSION_MINOR=`echo $dbus_version | awk -F. '{print $2}'`
+-DBUS_VERSION_MICRO=`echo $dbus_version | awk -F. '{print $3}'`
+-if test "z$DBUS_VERSION_MAJOR" = "z"; then
+-        DBUS_VERSION_MAJOR="0"
+-fi
+-if test "z$DBUS_VERSION_MINOR" = "z"; then
+-        DBUS_VERSION_MINOR="0"
+-fi
+-if test "z$DBUS_VERSION_MICRO" = "z"; then
+-        DBUS_VERSION_MICRO="0"
+-fi
+-
+-if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then        echo "Error: Couldn't determine the version of your DBUS package."
+-        echo "  This is probably an error in this script, please report it"
+-        echo "  along with the following information:"
+-        echo "      Base DBUS version ='$dbus_version'"
+-        echo "      DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
+-        echo "      DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
+-        echo "      DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
+-        exit 1
+-else
+-
+-        echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
+-        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
+-        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
+-        DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
+-
+-        AC_SUBST(DBUS_CFLAGS)
+-fi
+ 
+ dnl ---------------------------------------------------------------------------
+ dnl - Are we specifying a different dbus root ?
+ dnl ---------------------------------------------------------------------------
+ 
+ AC_ARG_WITH(dbus-sys,
+-	[AC_HELP_STRING([--with-dbus-sys=<dir>],
+-	[where D-BUS system.d directory is])])
++	[AS_HELP_STRING([--with-dbus-sys=<dir>],[where D-BUS system.d directory is])])
+ AC_ARG_WITH(dbus-services,
+-	[AC_HELP_STRING([--with-dbus-services=<dir>],
+-	[where D-BUS services directory is])])
++	[AS_HELP_STRING([--with-dbus-services=<dir>],[where D-BUS services directory is])])
+ if ! test -z "$with_dbus_sys" ; then
+         DBUS_SYS_DIR="$with_dbus_sys"
+ else
+@@ -158,8 +124,7 @@ dnl - PID file
+ dnl ---------------------------------------------------------------------------
+ 
+ AC_ARG_WITH(pid-file,
+-	[AC_HELP_STRING([--with-pid-file=<file>],
+-	[pid file location])])
++	[AS_HELP_STRING([--with-pid-file=<file>],[pid file location])])
+ 
+ if ! test -z "$with_pid_file"; then
+    CONSOLE_KIT_PID_FILE=$with_pid_file
+@@ -190,6 +155,9 @@ case "$host" in
+         *-*-solaris*)
+         CK_BACKEND="solaris"
+         ;;
++        *-*-gnu*)
++        CK_BACKEND="gnu"
++        ;;
+ 	*)
+ 	AC_MSG_ERROR([No sysdeps back-end implemented for host $host])
+ 	;;
+@@ -200,6 +168,7 @@ AC_SUBST(KVM_LIBS)
+ AM_CONDITIONAL(CK_COMPILE_LINUX, test x$CK_BACKEND = xlinux, [Compiling for Linux])
+ AM_CONDITIONAL(CK_COMPILE_FREEBSD, test x$CK_BACKEND = xfreebsd, [Compiling for FreeBSD])
+ AM_CONDITIONAL(CK_COMPILE_SOLARIS, test x$CK_BACKEND = xsolaris, [Compiling for Solaris])
++AM_CONDITIONAL(CK_COMPILE_GNU, test x$CK_BACKEND = xgnu, [Compiling for GNU])
+ AC_SUBST(CK_BACKEND)
+ 
+ dnl ---------------------------------------------------------------------------
+@@ -221,8 +190,7 @@ AC_CHECK_LIB(pam, pam_syslog, [AC_DEFINE(HAVE_PAM_SYSLOG, [], [Define to 1 if yo
+ # Check if we should build the PAM module
+ msg_pam_module=no
+ AC_ARG_ENABLE(pam-module,
+-	[AC_HELP_STRING([--enable-pam-module],
+-	[build PAM module])],
++	[AS_HELP_STRING([--enable-pam-module],[build PAM module])],
+         , enable_pam_module=no)
+ if test "x$enable_pam_module" = "xyes"; then
+ 	if test "x$have_pam" = "xno"; then
+@@ -233,13 +201,32 @@ if test "x$enable_pam_module" = "xyes"; then
+ fi
+ AM_CONDITIONAL(ENABLE_PAM_MODULE, test "x$enable_pam_module" = "xyes")
+ 
++dnl ------------------------------------------------------------------------------
++dnl udev-acl - apply ACLs for users with local forground sessions
++dnl ------------------------------------------------------------------------------
++AC_ARG_ENABLE([udev-acl],
++	AS_HELP_STRING([--enable-udev-acl], [enable local user acl permissions support @<:@default=disabled@:>@]),
++	[], [enable_udev_acl=no])
++AS_IF([test "x$enable_udev_acl" = "xyes"], [
++
++	PKG_CHECK_MODULES([UDEV_ACL], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0 libudev])
++	AC_CHECK_LIB([acl], [acl_init], [UDEV_ACL_LIBS="$UDEV_ACL_LIBS -lacl"], AC_MSG_ERROR([libacl not found]))
++	AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
++	UDEVDIR=`$PKG_CONFIG --variable udevdir udev`
++	if test -z "$UDEVDIR" ; then
++		UDEVDIR="/lib/udev"
++	fi
++	AC_SUBST(UDEVDIR)
++])
++AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"])
++
++
+ dnl ---------------------------------------------------------------------------
+ dnl - Install directory for PAM security module
+ dnl ---------------------------------------------------------------------------
+ 
+ AC_ARG_WITH(pam-module-dir,
+-	[AC_HELP_STRING([--with-pam-module-dir=<dir>],
+-	[directory to install PAM security module])])
++	[AS_HELP_STRING([--with-pam-module-dir=<dir>],[directory to install PAM security module])])
+ if ! test -z "$with_pam_module_dir"; then
+ 	PAM_MODULE_DIR="$with_pam_module_dir"
+ else
+@@ -252,8 +239,7 @@ dnl - DocBook Documentation
+ dnl ---------------------------------------------------------------------------
+ 
+ AC_ARG_ENABLE(docbook-docs,
+-	[AC_HELP_STRING([--enable-docbook-docs],
+-	[build documentation (requires xmlto)])],
++	[AS_HELP_STRING([--enable-docbook-docs],[build documentation (requires xmlto)])],
+ 	enable_docbook_docs=$enableval,enable_docbook_docs=no)
+ AC_PATH_PROG(XMLTO, xmlto, no)
+ AC_MSG_CHECKING([whether to build DocBook documentation])
+@@ -308,8 +294,7 @@ dnl ---------------------------------------------------------------------------
+ 
+ msg_rbac_shutdown=no
+ AC_ARG_ENABLE(rbac-shutdown,
+-	[AC_HELP_STRING([--enable-rbac-shutdown=<key>],
+-	[Build with RBAC support specifying shutdown/reboot RBAC authentication key])],
++	[AS_HELP_STRING([--enable-rbac-shutdown=<key>],[Build with RBAC support specifying shutdown/reboot RBAC authentication key])],
+ 	enable_rbac_shutdown=$enableval,enable_rbac_shutdown=no)
+ if test "x$enable_rbac_shutdown" != "xno"; then
+ 	RBAC_LIBS="-lsecdb -lsocket -lnsl"
+@@ -326,8 +311,7 @@ dnl ---------------------------------------------------------------------------
+ # Turn on the additional warnings last, so -Werror doesn't affect other tests.
+ 
+ AC_ARG_ENABLE(more-warnings,
+-	[AC_HELP_STRING([--enable-more-warnings],
+-	[Maximum compiler warnings])],
++	[AS_HELP_STRING([--enable-more-warnings],[Maximum compiler warnings])],
+ 	set_more_warnings="$enableval",[
+         	if test -d $srcdir/.git; then
+         		set_more_warnings=yes
+@@ -349,9 +333,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
+                 SAVE_CFLAGS="$CFLAGS"
+                 CFLAGS="$CFLAGS $option"
+                 AC_MSG_CHECKING([whether gcc understands $option])
+-                AC_TRY_COMPILE([], [],
+-                        has_option=yes,
+-                        has_option=no,)
++                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[has_option=yes],[has_option=no])
+                 if test $has_option = no; then
+                         CFLAGS="$SAVE_CFLAGS"
+                 fi
+@@ -368,8 +350,7 @@ fi
+ # Enable Debug
+ #
+ AC_ARG_ENABLE(debug,
+-	[AC_HELP_STRING([--enable-debug],
+-	[turn on debugging])],
++	[AS_HELP_STRING([--enable-debug],[turn on debugging])],
+ 	, enable_debug=yes)
+ if test "$enable_debug" = "yes"; then
+ 	DEBUG_CFLAGS="-DG_ENABLE_DEBUG"
+@@ -395,10 +376,9 @@ AC_SUBST(LDFLAGS)
+ 
+ AC_ARG_WITH([systemdsystemunitdir],
+         AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+-        [],
+-        [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+-AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+-AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
++        [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
++AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
++AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno"])
+ 
+ # Files
+ 
+@@ -445,6 +425,7 @@ echo "
+         Build backend:            ${CK_BACKEND}
+         PAM module dir:           ${PAM_MODULE_DIR}
+         Build PAM module:         ${msg_pam_module}
++        Build udev-acl:           ${enable_udev_acl}
+         Build docs:               ${enable_docbook_docs}
+ 
+         PolicyKit support         ${have_polkit}
+diff --git a/pam-ck-connector/pam-ck-connector.c b/pam-ck-connector/pam-ck-connector.c
+index 9bdef51..949a9b0 100644
+--- a/pam-ck-connector/pam-ck-connector.c
++++ b/pam-ck-connector/pam-ck-connector.c
+@@ -244,12 +244,12 @@ pam_sm_open_session (pam_handle_t *pamh,
+         const char *s;
+         uid_t       uid;
+         char        buf[256];
+-        char        ttybuf[PATH_MAX];
++        char       *ttybuf;
+         DBusError   error;
+         dbus_bool_t is_local;
+ 
+         ret = PAM_IGNORE;
+-
++        ttybuf = NULL;
+         is_local = TRUE;
+ 
+         _parse_pam_args (pamh, flags, argc, argv);
+@@ -295,7 +295,13 @@ pam_sm_open_session (pam_handle_t *pamh,
+                 x11_display = display_device;
+                 display_device = "";
+         } else if (strncmp (_PATH_DEV, display_device, 5) != 0) {
+-                snprintf (ttybuf, sizeof (ttybuf), _PATH_DEV "%s", display_device);
++                int len = strlen (_PATH_DEV) + strlen (display_device) + 1;
++                ttybuf = malloc (len);
++                if (ttybuf == NULL) {
++                        ck_pam_syslog (pamh, LOG_ERR, "oom allocating ttybuf");
++                        goto out;
++                }
++                snprintf (ttybuf, len, _PATH_DEV "%s", display_device);
+                 display_device = ttybuf;
+         }
+ 
+@@ -411,6 +417,8 @@ pam_sm_open_session (pam_handle_t *pamh,
+         ret = PAM_SUCCESS;
+ 
+ out:
++        free (ttybuf);
++
+         return ret;
+ }
+ 
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 869decd..217e531 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -57,11 +57,18 @@ libck_la_SOURCES +=		\
+ 	$(NULL)
+ libck_la_LIBADD = $(KVM_LIBS)
+ endif
++if CK_COMPILE_GNU
++libck_la_SOURCES +=		\
++	ck-sysdeps-gnu.c	\
++	$(NULL)
++libck_la_LIBADD = -lps
++endif
+ 
+ EXTRA_libck_la_SOURCES =		\
+ 	ck-sysdeps-linux.c		\
+ 	ck-sysdeps-solaris.c		\
+ 	ck-sysdeps-freebsd.c		\
++	ck-sysdeps-gnu.c		\
+ 	$(NULL)
+ 
+ sbin_PROGRAMS = 		\
+diff --git a/src/ck-sysdeps-gnu.c b/src/ck-sysdeps-gnu.c
+new file mode 100644
+index 0000000..254f7ef
+--- /dev/null
++++ b/src/ck-sysdeps-gnu.c
+@@ -0,0 +1,402 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
++ *
++ * Copyright (C) 2009 Pino Toscano <pino at kde.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++ *
++ */
++
++#include "config.h"
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <string.h>
++#include <errno.h>
++
++#include <hurd.h>
++#include <dirent.h>
++#include <ps.h>
++#include <ttyent.h>
++
++#ifdef HAVE_PATHS_H
++#include <paths.h>
++#endif /* HAVE_PATHS_H */
++
++#include "ck-sysdeps.h"
++
++struct _CkProcessStat
++{
++        struct proc_stat *ps;           /* the statistics of a process */
++};
++
++static struct ps_context *pc = NULL;
++
++static gboolean
++get_proc_stat_from_pid (pid_t              pid,
++                        ps_flags_t         flags,
++                        struct proc_stat **res_ps)
++{
++        error_t           err;
++        struct proc_stat *ps;
++
++        g_assert (pid >= 0);
++        g_assert (res_ps != NULL);
++
++        if (pc == NULL) {
++                err = ps_context_create (getproc (), &pc);
++                if (err) {
++                    return FALSE;
++                }
++        }
++
++        err = _proc_stat_create (pid, pc, &ps);
++        if (err) {
++                return FALSE;
++        }
++
++        err = proc_stat_set_flags (ps, PSTAT_PID | flags);
++        if (err) {
++                return FALSE;
++        }
++
++        *res_ps = ps;
++        return TRUE;
++}
++
++
++pid_t
++ck_process_stat_get_ppid (CkProcessStat *stat)
++{
++        g_return_val_if_fail (stat != NULL, -1);
++
++        return proc_stat_pid (stat->ps);
++}
++
++char *
++ck_process_stat_get_cmd (CkProcessStat *stat)
++{
++        g_return_val_if_fail (stat != NULL, NULL);
++
++        return g_strdup (proc_stat_args (stat->ps));
++}
++
++char *
++ck_process_stat_get_tty (CkProcessStat *stat)
++{
++        struct ps_tty    *tty;
++
++        g_return_val_if_fail (stat != NULL, NULL);
++
++        tty = proc_stat_tty (stat->ps);
++
++        return tty ? g_strdup (ps_tty_name (tty)) : NULL;
++}
++
++gboolean
++ck_process_stat_new_for_unix_pid (pid_t           pid,
++                                  CkProcessStat **stat,
++                                  GError        **error)
++{
++        gboolean          res;
++        struct proc_stat *ps;
++        CkProcessStat    *proc;
++
++        g_return_val_if_fail (pid > 1, FALSE);
++
++        if (stat == NULL) {
++                return FALSE;
++        }
++
++        *stat = NULL;
++
++        res = get_proc_stat_from_pid (pid, PSTAT_ARGS | PSTAT_TTY, &ps);
++        if (!res) {
++                return FALSE;
++        }
++
++        proc = g_new0 (CkProcessStat, 1);
++        proc->ps = ps;
++        *stat = proc;
++
++        return TRUE;
++}
++
++void
++ck_process_stat_free (CkProcessStat *stat)
++{
++        _proc_stat_free (stat->ps);
++
++        g_free (stat);
++}
++
++GHashTable *
++ck_unix_pid_get_env_hash (pid_t pid)
++{
++        struct proc_stat *ps;
++        char             *env_p;
++        size_t            env_index;
++        size_t            env_l;
++        gboolean          res;
++        GHashTable       *hash;
++
++        g_return_val_if_fail (pid > 1, NULL);
++
++        res = get_proc_stat_from_pid (pid, PSTAT_ENV, &ps);
++        if (!res) {
++                return NULL;
++        }
++
++        hash = g_hash_table_new_full (g_str_hash,
++                                      g_str_equal,
++                                      g_free,
++                                      g_free);
++
++        env_index = 0;
++        env_l = 0;
++        env_p = proc_stat_env (ps);
++        while (env_index < proc_stat_env_len (ps)) {
++                env_l = strlen (env_p);
++                env_index += env_l + 1;
++                if (env_l) {
++                        char **vals;
++                        vals = g_strsplit (env_p, "=", 2);
++                        if (vals != NULL) {
++                                g_hash_table_insert (hash,
++                                                     g_strdup (vals[0]),
++                                                     g_strdup (vals[1]));
++                                g_strfreev (vals);
++                        }
++                }
++                env_p = env_p + env_l + 1;
++        }
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/packages/ConsoleKit/ConsoleKit.spec?r1=1.49&r2=1.50



More information about the pld-cvs-commit mailing list