summaryrefslogtreecommitdiff
path: root/builtins/jobs.def
diff options
context:
space:
mode:
Diffstat (limited to 'builtins/jobs.def')
-rw-r--r--builtins/jobs.def12
1 files changed, 7 insertions, 5 deletions
diff --git a/builtins/jobs.def b/builtins/jobs.def
index 76d1957f..4c3ba6a7 100644
--- a/builtins/jobs.def
+++ b/builtins/jobs.def
@@ -1,7 +1,7 @@
This file is jobs.def, from which is created jobs.c.
It implements the builtins "jobs" and "disown" in Bash.
-Copyright (C) 1987-2004 Free Software Foundation, Inc.
+Copyright (C) 1987-2005 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -141,7 +141,7 @@ jobs_builtin (list)
BLOCK_CHILD (set, oset);
job = get_job_spec (list);
- if ((job == NO_JOB) || !jobs || !jobs[job])
+ if ((job == NO_JOB) || jobs == 0 || get_job_by_jid (job) == 0)
{
sh_badjob (list->word->word);
any_failed++;
@@ -162,6 +162,7 @@ execute_list_with_replacements (list)
register WORD_LIST *l;
int job, result;
COMMAND *command;
+ JOB *j;
/* First do the replacement of job specifications with pids. */
for (l = list; l; l = l->next)
@@ -171,11 +172,12 @@ execute_list_with_replacements (list)
job = get_job_spec (l);
/* A bad job spec is not really a job spec! Pass it through. */
- if (job < 0 || job >= job_slots || !jobs[job])
+ if (INVALID_JOB (job))
continue;
+ j = get_job_by_jid (job);
free (l->word->word);
- l->word->word = itos (jobs[job]->pgrp);
+ l->word->word = itos (j->pgrp);
}
}
@@ -257,7 +259,7 @@ disown_builtin (list)
? get_job_by_pid ((pid_t) pid_value, 0)
: get_job_spec (list);
- if (job == NO_JOB || jobs == 0 || job < 0 || job >= job_slots || jobs[job] == 0)
+ if (job == NO_JOB || jobs == 0 || INVALID_JOB (job))
{
sh_badjob (list ? list->word->word : "current");
retval = EXECUTION_FAILURE;