pwait (in library.c) ignore spurious returns from wait -- this caused
a rather annoying bug to occur when doing a "sh" command
SCCS-vsn: old/dbx/process.c 1.11
/* Copyright (c) 1982 Regents of the University of California */
/* Copyright (c) 1982 Regents of the University of California */
-static char sccsid[] = "@(#)process.c 1.10 %G%";
+static char sccsid[] = "@(#)process.c 1.11 %G%";
#define MAXNCMDARGS 100 /* maximum number of arguments to RUN */
#define MAXNCMDARGS 100 /* maximum number of arguments to RUN */
private Boolean just_started;
private int argc;
private String argv[MAXNCMDARGS];
private Boolean just_started;
private int argc;
private String argv[MAXNCMDARGS];
if (process->status == FINISHED) {
exit(0);
} else {
if (process->status == FINISHED) {
exit(0);
} else {
String outfile;
{
int status;
String outfile;
{
int status;
if (p->pid != 0) { /* child already running? */
ptrace(PKILL, p->pid, 0, 0); /* ... kill it! */
if (p->pid != 0) { /* child already running? */
ptrace(PKILL, p->pid, 0, 0); /* ... kill it! */
+ pwait(p->pid, &status); /* wait for it to exit */
+ unptraced(p->pid);
}
psigtrace(p, SIGTRAP, true);
}
psigtrace(p, SIGTRAP, true);
- if ((p->pid = vfork()) == -1) {
+ p->pid = vfork();
+ if (p->pid == -1) {
panic("can't fork");
}
if (ischild(p->pid)) {
panic("can't fork");
}
if (ischild(p->pid)) {
traceme();
if (infile != nil) {
in = open(infile, 0);
traceme();
if (infile != nil) {
in = open(infile, 0);
if (p->status != STOPPED) {
error("program could not begin execution");
}
if (p->status != STOPPED) {
error("program could not begin execution");
}
setinfo(p, signo);
sigs_off();
if (ptrace(CONT, p->pid, p->reg[PROGCTR], p->signo) < 0) {
setinfo(p, signo);
sigs_off();
if (ptrace(CONT, p->pid, p->reg[PROGCTR], p->signo) < 0) {
- panic("can't continue process");
+ panic("error %d trying to continue process", errno);
}
pwait(p->pid, &status);
sigs_on();
}
pwait(p->pid, &status);
sigs_on();