aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c
index fd2fc9f23..8d1822847 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -1678,15 +1678,16 @@ popstackmark(struct stackmark *mark)
1678 * part of the block that has been used. 1678 * part of the block that has been used.
1679 */ 1679 */
1680static void 1680static void
1681growstackblock(void) 1681growstackblock(size_t min)
1682{ 1682{
1683 size_t newlen; 1683 size_t newlen;
1684 1684
1685 newlen = g_stacknleft * 2; 1685 newlen = g_stacknleft * 2;
1686 if (newlen < g_stacknleft) 1686 if (newlen < g_stacknleft)
1687 ash_msg_and_raise_error(bb_msg_memory_exhausted); 1687 ash_msg_and_raise_error(bb_msg_memory_exhausted);
1688 if (newlen < 128) 1688 min = SHELL_ALIGN(min | 128);
1689 newlen += 128; 1689 if (newlen < min)
1690 newlen += min;
1690 1691
1691 if (g_stacknxt == g_stackp->space && g_stackp != &stackbase) { 1692 if (g_stacknxt == g_stackp->space && g_stackp != &stackbase) {
1692 struct stack_block *sp; 1693 struct stack_block *sp;
@@ -1736,16 +1737,15 @@ static void *
1736growstackstr(void) 1737growstackstr(void)
1737{ 1738{
1738 size_t len = stackblocksize(); 1739 size_t len = stackblocksize();
1739 growstackblock(); 1740 growstackblock(0);
1740 return (char *)stackblock() + len; 1741 return (char *)stackblock() + len;
1741} 1742}
1742 1743
1743static char * 1744static char *
1744growstackto(size_t len) 1745growstackto(size_t len)
1745{ 1746{
1746 while (stackblocksize() < len) 1747 if (stackblocksize() < len)
1747 growstackblock(); 1748 growstackblock(len);
1748
1749 return stackblock(); 1749 return stackblock();
1750} 1750}
1751 1751