Hi!
> > This version looks nearly fine. I would check the return value from
> > waitpid() too, just for the sake of completness.
> >
> So, something like this is ok:
> if (waitpid(pid, &ret, 0) != pid)
>      tst_brkm(..."waitpid failed at ...")

Yes.

> > And looking at the waitpid() documentation it states that it uses only
> > two bytes from ret (in reality it's cleared to zero but that is not
> > promised in specification).
> >
> > I would change the last condition to:
> >
> > if (!WIFEXITED(ret) || WEXITSTATUS(ret) != 0) {
> >
> > }
> But the waitpid() manual says that WEXITSTATUS should only be employed 
> if WIFEXITED returned true, so may be change it to:
> if (!WIFEXITED(ret) || (WIFEXITED(ret) && WEXITSTATUS(ret) != 0)) {
> ...
> }

The short circuit evaluation will take care of that.

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to