From c12d330ddc951c5e6761c0535a4c5dd079d0a777 Mon Sep 17 00:00:00 2001 From: cvpcs Date: Sun, 6 Jun 2010 18:06:59 -0500 Subject: fixed some problems with bash --- builtins/common.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'builtins/common.c') diff --git a/builtins/common.c b/builtins/common.c index f02e99c..b69e7a2 100644 --- a/builtins/common.c +++ b/builtins/common.c @@ -553,10 +553,23 @@ get_working_directory (for_whom) if (the_current_working_directory == 0) { -#if defined (GETCWD_BROKEN) - the_current_working_directory = getcwd (0, PATH_MAX); +#if defined (__BIONIC__) + /** + * This is a really lame work around to try to stop bash from flipping + * out if PWD isn't defined when starting it up on bionic + */ + char *d = (char *)malloc(sizeof(char) * PATH_MAX); + the_current_working_directory = getcwd (d, sizeof(d)); + if (the_current_working_directory) + the_current_working_directory = d; + else + FREE (d); #else +# if defined (GETCWD_BROKEN) + the_current_working_directory = getcwd (0, PATH_MAX); +# else the_current_working_directory = getcwd (0, 0); +# endif #endif if (the_current_working_directory == 0) { -- cgit v1.1