ash: exec: Do not allocate stack string in padvance
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Feb 2020 14:27:41 +0000 (15:27 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Feb 2020 14:59:44 +0000 (15:59 +0100)
commitb0d2dc7d62f6dea67b82e451510fa77243b4c60c
tree163ee1a1459a707e0a678e7e5dcb853405413138
parentc55847fedbc3cbc10f2558c5449d8635f318ce49
ash: exec: Do not allocate stack string in padvance

Upstream commit:

    Date: Sat, 19 May 2018 02:39:48 +0800
    exec: Do not allocate stack string in padvance

    Many callers of padvance immediately free the allocated string
    so this patch moves the stalloc call to the caller.  Instead of
    returning the allocated string, padvance now returns the length
    to allocate (this may be longer than the actual string length,
    even including the NUL).  For the case where we would previously
    return NULL, we now return -1.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c