Re: [PATCH] jobs: Fix here-document crash

Hadrien LACOUR <[email protected]> Tue, 3 Feb 2026 09:38:11 +0100
Newsgroups org.kernel.vger.dash
Message-ID <CAKmiXchWEy3MwPvHTrOhAyBU9p7gxdk=0m3FH5vtZ9AnjedpaA@mail.gmail.com>
Works here, thanks!

Le mar. 3 f=C3=A9vr. 2026 =C3=A0 06:36, Herbert Xu <[email protected]=
g.au> a =C3=A9crit :
>
> When forkchild is called while expanding here-documents, the job
> pointer is set to NULL.  If this is the case, there is no need
> to free the job pointer and other outstanding jobs.  Simply return
> if this is the case.
>
> Reported-by: Hadrien LACOUR <[email protected]>
> Fixes: 9881d00e939e ("jobs: Preserve parent jobs for simple commands")
> Signed-off-by: Herbert Xu <[email protected]>
>
> diff --git a/src/jobs.c b/src/jobs.c
> index 6622bdd..36c6261 100644
> --- a/src/jobs.c
> +++ b/src/jobs.c
> @@ -919,6 +919,9 @@ static void forkchild(struct job *jp, union node *n, =
int mode)
>         if (lvforked)
>                 return;
>
> +       if (!jp)
> +               return;
> +
>         freejob(jp);
>
>         if (issimplecmd(n, JOBSCMD->name))
> --
> Email: Herbert Xu <[email protected]>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt