policykit-gnome r20 - trunk/src



Author: davidz
Date: Mon Apr 21 18:00:00 2008
New Revision: 20
URL: http://svn.gnome.org/viewvc/policykit-gnome?rev=20&view=rev

Log:
use polkit function instead of Linux specific code for getting exe name


Modified:
   trunk/src/polkit-gnome-manager.c

Modified: trunk/src/polkit-gnome-manager.c
==============================================================================
--- trunk/src/polkit-gnome-manager.c	(original)
+++ trunk/src/polkit-gnome-manager.c	Mon Apr 21 18:00:00 2008
@@ -359,22 +359,13 @@
 {
         char *result;
         char buf[PATH_MAX];
-        ssize_t len;
-        char proc_name[32];
 
-        result = NULL;
-
-        snprintf (proc_name, sizeof (proc_name), "/proc/%d/exe", pid);
-        len = readlink (proc_name, buf, sizeof (buf) - 1);
-        if (len == -1) {
-                goto out;
+        if (polkit_sysdeps_get_exe_for_pid_with_helper (pid, buf, sizeof buf) < 0) {
+                result = g_strdup (_("(unknown"));
+        } else {
+                result =  g_strdup (buf);
         }
-        g_assert (len >= 0 && len < PATH_MAX - 1);
 
-        buf[len] = '\0';
-        result = g_strdup (buf);
-
-out:
         return result;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]