aboutsummaryrefslogtreecommitdiffstats
path: root/builtins/common.c
diff options
context:
space:
mode:
authorcvpcs <root@cvpcs.org>2010-06-06 18:06:59 -0500
committercvpcs <root@cvpcs.org>2010-06-06 18:06:59 -0500
commitc12d330ddc951c5e6761c0535a4c5dd079d0a777 (patch)
tree86c9073011af5d881bce63b5ea52111a211f9932 /builtins/common.c
parent5999b91c4395ce08fd3e893d98e9f4b54b05ac02 (diff)
downloadexternal_bash-c12d330ddc951c5e6761c0535a4c5dd079d0a777.zip
external_bash-c12d330ddc951c5e6761c0535a4c5dd079d0a777.tar.gz
external_bash-c12d330ddc951c5e6761c0535a4c5dd079d0a777.tar.bz2
fixed some problems with bash
Diffstat (limited to 'builtins/common.c')
-rw-r--r--builtins/common.c17
1 files changed, 15 insertions, 2 deletions
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)
{