[PATCH] jobs: Make stoppedjobs trivial if JOBS == 0

Herbert Xu <[email protected]> Mon, 16 Mar 2026 13:24:32 +0900
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Denys Vlasenko <[email protected]> wrote:
> Good day,
> 
> There is only one place where JOBSTOOPED can be set,
> and this place is conditional on #if JOBS:

Do you actually use dash with JOBS == 0?

I wonder how much testing this actually gets because I have never
used it.  We could do something like this for stoppedjobs.

---8<---
When job control is disabled or unavailable, stoppedjobs doesn't
need to do any work.

Reported-by: Denys Vlasenko <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>

diff --git a/src/jobs.c b/src/jobs.c
index 36c6261..4aa65b6 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -1237,6 +1237,8 @@ stoppedjobs(void)
 	int retval;
 
 	retval = 0;
+	if (!JOBS)
+		goto out;
 	if (job_warning)
 		goto out;
 	jp = curjob;
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt