Bug 23093 – FreeBSD portability fixes
authorJoe Marcus Clarke <marcus@freebsd.org>
Wed, 12 Aug 2009 14:04:15 +0000 (10:04 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Wed, 12 Aug 2009 14:04:15 +0000 (10:04 -0400)
commitde9453f4c178fe76a4a36edb752e2ed75a329032
tree70c9acfa847f5600dcafb5edbd7f99dfd1b7c9ba
parent933e21f13a44c556dcc1e4ce5c2493baf785ee76
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>
configure.ac
src/examples/frobnicate.c
src/polkit/polkitunixgroup.c
src/polkit/polkitunixprocess.c
src/polkit/polkitunixprocess.h
src/polkit/polkitunixuser.c
src/polkitagent/polkitagenthelper.c
src/polkitbackend/polkitbackendlocalauthority.c
src/polkitbackend/polkitbackendsessionmonitor.c
src/programs/pkexec.c