PolicyKit: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Thu Oct 15 13:57:40 PDT 2009
src/examples/frobnicate.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
New commits:
commit d7a5e544a47f5dcaa4737ddf73b959756503ab66
Author: Samuel Thibault <sthibault at debian.org>
Date: Thu Oct 15 16:52:40 2009 -0400
Bug 24495 â Fails to build on platforms without PATH_MAX (like hurd)
PATH_MAX, which hurd-i386 doesn't define since it doesn't have such
arbitrary limitation. The attached patch fixes it by just using
glibc's get_current_dir_name() extension when available.
Signed-off-by: Michael Biebl <mbiebl at gmail.com>
Signed-off-by: David Zeuthen <davidz at redhat.com>
diff --git a/src/examples/frobnicate.c b/src/examples/frobnicate.c
index 9de4b49..c87c2dc 100644
--- a/src/examples/frobnicate.c
+++ b/src/examples/frobnicate.c
@@ -19,8 +19,10 @@
* Author: David Zeuthen <davidz at redhat.com>
*/
+#define _GNU_SOURCE
#include <glib.h>
#include <unistd.h>
+#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
@@ -31,13 +33,21 @@ main (int argc, char *argv[])
gchar **env;
guint n;
int ret;
+#ifdef __GLIBC__
+ gchar *cwd = NULL;
+#else
gchar cwd[PATH_MAX];
+#endif
ret = 1;
args = NULL;
env = NULL;
+#ifdef __GLIBC__
+ if ((cwd = get_current_dir_name ()))
+#else
if (getcwd (cwd, sizeof cwd) == NULL)
+#endif
{
g_printerr ("Error getting cwd: %s", g_strerror (errno));
goto out;
@@ -62,6 +72,9 @@ main (int argc, char *argv[])
out:
+#ifdef __GLIBC__
+ free (cwd);
+#endif
g_free (args);
g_strfreev (env);
More information about the hal-commit
mailing list