more IRC deliberation with igli (let’s hope the “const” works), plus style advice from Kernighan’s writs

This commit is contained in:
tg
2015-02-20 13:08:28 +00:00
parent 5efc48befd
commit 06045cf889

19
jobs.c
View File

@ -23,7 +23,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.107 2015/02/20 12:43:22 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.108 2015/02/20 13:08:28 tg Exp $");
#if HAVE_KILLPG #if HAVE_KILLPG
#define mksh_killpg killpg #define mksh_killpg killpg
@ -1111,6 +1111,7 @@ j_waitj(Job *j,
int flags, int flags,
const char *where) const char *where)
{ {
Proc *p;
int rv; int rv;
#ifdef MKSH_NO_SIGSUSPEND #ifdef MKSH_NO_SIGSUSPEND
sigset_t omask; sigset_t omask;
@ -1238,9 +1239,10 @@ j_waitj(Job *j,
j_systime = j->systime; j_systime = j->systime;
rv = j->status; rv = j->status;
if ((flags & JW_PIPEST) && (j->proc_list != NULL)) { if (!(p = j->proc_list)) {
/* nothing */;
} else if (flags & JW_PIPEST) {
uint32_t num = 0; uint32_t num = 0;
Proc *p = j->proc_list;
struct tbl *vp; struct tbl *vp;
unset(vp_pipest, 1); unset(vp_pipest, 1);
@ -1270,14 +1272,13 @@ j_waitj(Job *j,
rv = vp->val.i; rv = vp->val.i;
p = p->next; p = p->next;
} }
} else if (Flag(FPIPEFAIL) && (j->proc_list != NULL)) { } else if (Flag(FPIPEFAIL)) {
Proc *p = j->proc_list;
int i;
do { do {
if ((i = proc_errorlevel(p))) const int i = proc_errorlevel(p);
if (i)
rv = i; rv = i;
} while ((p = p->next) != NULL); } while ((p = p->next));
} }
if (!(flags & JW_ASYNCNOTIFY) if (!(flags & JW_ASYNCNOTIFY)