diff options
author | Joe Marcus Clarke <marcus@freebsd.org> | 2009-08-12 10:04:15 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2009-08-12 10:04:15 -0400 |
commit | de9453f4c178fe76a4a36edb752e2ed75a329032 (patch) | |
tree | 70c9acfa847f5600dcafb5edbd7f99dfd1b7c9ba /src/polkitagent | |
parent | 933e21f13a44c556dcc1e4ce5c2493baf785ee76 (diff) | |
download | polkit-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.c | 12 |
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. |