From 203e8395faa9135956e3b2a2b749b6dd96a7e988 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Mon, 6 Jun 2016 22:45:27 +0800 Subject: 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: Stephen Kitt Signed-off-by: Herbert Xu --- src/jobs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/jobs.c b/src/jobs.c index 3997863..4f02e38 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -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; @@ -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"; -- cgit 1.4.1 ger.1?h=3.1&id=9380231e0ef0398ffb2ad2a6d455ded9fd40e73f'>tree commit diff
Commit message (Expand)Author
2019-10-24Register readers by client usernamesJune McEnroe
2019-10-24Unset non-blocking on clientsJune McEnroe
2019-10-24Intercept client QUITJune McEnroe
2019-10-24Only set NeedCapEnd if unregisteredJune McEnroe
2019-10-24Set client-side origin to irc.invalidJune McEnroe
2019-10-24Factor out client-side origin nameJune McEnroe
2019-10-24Intercept all CAP commands from clientsJune McEnroe
2019-10-24Ignore further CAP ENDJune McEnroe
2019-10-24Implement client CAP for server-timeJune McEnroe
2019-10-24Implement ringWriteJune McEnroe
2019-10-24Make clientFormat publicJune McEnroe
2019-10-24Make serverFormat publicJune McEnroe
2019-10-24Rename some thingsJune McEnroe
2019-10-23Add ISUPPORT draft to STANDARDSJune McEnroe
2019-10-23Track own originJune McEnroe
2019-10-23Track channels and sync ISUPPORTJune McEnroe
2019-10-23Track nick changesJune McEnroe
2019-10-23Rename Command to MessageJune McEnroe
2019-10-23Synchronize state after client registrationJune McEnroe
2019-10-23Send to server if client has no needsJune McEnroe
2019-10-23Implement some amount of client connectionJune McEnroe
2019-10-23Set clients non-blockingJune McEnroe
2019-10-23Clean up state.c and factor out parsingJune McEnroe
2019-10-23Respond to pingsJune McEnroe
2019-10-23Add verbose flagJune McEnroe
2019-10-23Set NOSIGPIPE on server connectionJune McEnroe
2019-10-23Set an initial loop capJune McEnroe
2019-10-23Fix rest parsingJune McEnroe
2019-10-23Add dynamic poll listJune McEnroe
2019-10-23Don't assume commands have targets and handle ERRORJune McEnroe
2019-10-23Clean up state somewhatJune McEnroe
2019-10-23Actually send the buffer...June McEnroe
2019-10-23Add stateJune McEnroe