aboutsummaryrefslogtreecommitdiffstats
path: root/builtins/common.c
diff options
context:
space:
mode:
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)
{