From 3279600ce42603dc3b49461294cd9eb124ca00f1 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Sat, 26 Mar 2011 07:28:14 +0000 Subject: [PATCH] Fix build on GNU Hurd https://bugs.freedesktop.org/show_bug.cgi?id=35685 --- src/programs/pkexec.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c index 9217954..459e4b9 100644 --- a/src/programs/pkexec.c +++ b/src/programs/pkexec.c @@ -53,6 +53,12 @@ static gchar original_cwd[PATH_MAX]; static gchar *command_line = NULL; static struct passwd *pw; +#ifdef __GLIBC__ +static gchar *original_cwd = NULL; +#else +static gchar original_cwd[PATH_MAX]; +#endif + #ifndef HAVE_CLEARENV extern char **environ; @@ -452,7 +458,11 @@ main (int argc, char *argv[]) goto out; } +#ifdef __GLIBC__ + if ((original_cwd = get_current_dir_name ()) == NULL) +#else if (getcwd (original_cwd, sizeof (original_cwd)) == NULL) +#endif { g_printerr ("Error getting cwd: %s\n", g_strerror (errno)); @@ -904,6 +914,9 @@ main (int argc, char *argv[]) g_ptr_array_free (saved_env, TRUE); } +#ifdef __GLIBC__ + free (original_cwd); +#endif g_free (path); g_free (command_line); g_free (opt_user); -- 1.7.4.1