From f67224cb2f60288c731b94975e20bd922eaacf6c Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 5 Sep 2021 16:12:39 +0100 Subject: ash: restrict valid job ids Although job control is disabled in busybox-w32 getjob() is still compiled in because it's used by waitcmd(). Job ids of the form '%string' or '%?string' don't work, though, because the command isn't stored in the job structure. Disable the code to handle them. Job ids '%%', '%+', '%-' and '%num' are still allowed and some of them are (successfully) used in the ash tests. Saves 144 bytes. --- shell/ash.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 279cc8ed4..ff2a54fbe 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -4411,12 +4411,16 @@ static struct job * getjob(const char *name, int getctl) { struct job *jp; +#if !ENABLE_PLATFORM_MINGW32 struct job *found; +#endif const char *err_msg = "%s: no such job"; unsigned num; int c; const char *p; +#if !ENABLE_PLATFORM_MINGW32 char *(*match)(const char *, const char *); +#endif jp = curjob; p = name; @@ -4457,6 +4461,7 @@ getjob(const char *name, int getctl) } } +#if !ENABLE_PLATFORM_MINGW32 match = prefix; if (*p == '?') { match = strstr; @@ -4476,6 +4481,9 @@ getjob(const char *name, int getctl) if (!found) goto err; jp = found; +#else + goto err; +#endif gotit: #if JOBS -- cgit v1.2.3-55-g6feb