summaryrefslogtreecommitdiff
path: root/src/polkitagent
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@freebsd.org>2009-08-12 10:04:15 -0400
committerDavid Zeuthen <davidz@redhat.com>2009-08-12 10:04:15 -0400
commitde9453f4c178fe76a4a36edb752e2ed75a329032 (patch)
tree70c9acfa847f5600dcafb5edbd7f99dfd1b7c9ba /src/polkitagent
parent933e21f13a44c556dcc1e4ce5c2493baf785ee76 (diff)
downloadpolkit-de9453f4c178fe76a4a36edb752e2ed75a329032.tar.gz
Bug 23093 – FreeBSD portability fixes
There are a few issues with building polkit-0.93 on FreeBSD: * No clearenv() function on FreeBSD * While FreeBSD has a /proc, it is deprecated, and kinfo_proc should be used instead. * FreeBSD's printf() functions do not support the %m notation. This is only supported for syslog(). * You can't call GINT_TO_POINTER() on a 64-bit value, as this will break on 64-bit OSes. The attached patch fixes these problems. First, a check for clearenv() is added to configure. Second, I moved the check for process uid to polkit/polkitunixprocess.c. This may not be ideal, but it seems to fit, and reduces code duplication. Third, I replaces all %m with %s ... g_strerror (errno). Finally, I replaced GINT_TO_POINTER() with GSIZE_TO_POINTER. Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'src/polkitagent')
-rw-r--r--src/polkitagent/polkitagenthelper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/polkitagent/polkitagenthelper.c b/src/polkitagent/polkitagenthelper.c
index 437eada..f85b0d4 100644
--- a/src/polkitagent/polkitagenthelper.c
+++ b/src/polkitagent/polkitagenthelper.c
@@ -35,6 +35,18 @@
# define LOG_AUTHPRIV (10<<3)
#endif
+#ifndef HAVE_CLEARENV
+extern char **environ;
+
+static int
+clearenv (void)
+{
+ if (environ != NULL)
+ environ[0] = NULL;
+ return 0;
+}
+#endif
+
/* Development aid: define PAH_DEBUG to get debugging output. Do _NOT_
* enable this in production builds; it may leak passwords and other
* sensitive information.