On Mon, Aug 02, 2021 at 11:25:29AM +0100, Dave Martin wrote: > That's a reasonable position, but thinking about it a bit more, there's > not really any loop at all here. > > There definitely is an unwaited-for child and we don't pass WHONANG to > wait(), so it will either return the child pid, or fail. > > Without WUNTRACED or similar, the child must terminate to wake up the > wait(). > So is this just a matter of > pid = wait(&ret); > if (pid == -1) { > /* barf */ > } > assert(pid == child); > > if (!WIFEXITED(ret)) { > /* barf */ > } > > if (WEXITSTATUS(ret) != 0) { > /* barf */ > } > > /* parse child's stdout etc. */ That really doesn't seem like a good idea - it's just asking for fragility if a signal gets delivered to the parent process or something. Even if almost all the time there will only be one trip through the loop we should still have the loop there for those few cases where it triggers. > > > Please delete unneeded context from mails when replying. Doing this > > makes it much easier to find your reply in the message, helping ensure > > it won't be missed by people scrolling through the irrelevant quoted > > material. > > Hmmm, usually I at least try to do that, but I did seem to leave rather > a lot of trailing junk that time. > > (Working out which context is relevant is not always an exact science, > but in this case, it looks like I just forgot.) > > Cheers > ---Dave
Attachment:
signature.asc
Description: PGP signature