Module Name: src Committed By: martin Date: Sat Feb 3 14:31:38 UTC 2024
Modified Files: src/bin/sh [netbsd-10]: jobs.c Log Message: Pull up following revision(s) (requested by kre in ticket #577): bin/sh/jobs.c: revision 1.119 PR bin/57894 For jobs -p for a non-job-control job, avoid just printing 0 (as there is no process group pid) and instead output what we used to, the pid of one of the processes in the job (usually the right one!) To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.117.2.1 src/bin/sh/jobs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/jobs.c diff -u src/bin/sh/jobs.c:1.117 src/bin/sh/jobs.c:1.117.2.1 --- src/bin/sh/jobs.c:1.117 Sun Oct 30 01:46:16 2022 +++ src/bin/sh/jobs.c Sat Feb 3 14:31:38 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: jobs.c,v 1.117 2022/10/30 01:46:16 kre Exp $ */ +/* $NetBSD: jobs.c,v 1.117.2.1 2024/02/03 14:31:38 martin Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: jobs.c,v 1.117 2022/10/30 01:46:16 kre Exp $"); +__RCSID("$NetBSD: jobs.c,v 1.117.2.1 2024/02/03 14:31:38 martin Exp $"); #endif #endif /* not lint */ @@ -439,7 +439,8 @@ showjob(struct output *out, struct job * #if JOBS if (mode & SHOW_PGID) { /* output only the process group ID (lead process ID) */ - outfmt(out, "%ld\n", (long)jp->pgrp); + outfmt(out, "%ld\n", + jp->pgrp != 0 ? (long)jp->pgrp : (long)jp->ps->pid); return; } #endif