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/examples | |
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/examples')
-rw-r--r-- | src/examples/frobnicate.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/examples/frobnicate.c b/src/examples/frobnicate.c index 6b6b8ff..9de4b49 100644 --- a/src/examples/frobnicate.c +++ b/src/examples/frobnicate.c @@ -21,6 +21,7 @@ #include <glib.h> #include <unistd.h> +#include <errno.h> #include <sys/types.h> int @@ -38,7 +39,7 @@ main (int argc, char *argv[]) if (getcwd (cwd, sizeof cwd) == NULL) { - g_printerr ("Error getting cwd: %m"); + g_printerr ("Error getting cwd: %s", g_strerror (errno)); goto out; } |