Skip to content
Snippets Groups Projects
Commit 203e8395 authored by Stephen Kitt's avatar Stephen Kitt Committed by Herbert Xu
Browse files

jobs: Handle string-based job descriptors


When looking for a job using a string descriptor, e.g.

	fg %man

the relevant loop in src/jobs.c only ever exits to the err label. With
this patch, when the end condition is reached, we check whether a job
was found, and if so, set things up to exit correctly via gotit.
Multiple matches are already caught using the test in the match block.

Signed-off-by: default avatarStephen Kitt <steve@sk2.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 551215bb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -714,9 +714,7 @@ check:
}
 
found = 0;
while (1) {
if (!jp)
goto err;
while (jp) {
if (match(jp->ps[0].cmd, p)) {
if (found)
goto err;
Loading
Loading
@@ -726,6 +724,10 @@ check:
jp = jp->prev_job;
}
 
if (!found)
goto err;
jp = found;
gotit:
#if JOBS
err_msg = "job %s not created under job control";
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment