in reply to Re: Waitpid Woes
in thread Waitpid Woes

Well... but the waitpid is in the second fork... shouldn't it only see its one child?

I had assumed that the waitpid would only catch your direct children.

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re: Re: Re: Waitpid Woes
by bluto (Curate) on Dec 17, 2003 at 19:37 UTC
    No, the same parent is forking both children. When you say 'if (fork)', the code in the first part of the if is the parent code, the part in the 'else' is the child.
      Duh.

      Doesn't solve my real problem, but solves my test problem, thanks.

                      - Ant
                      - Some of my best work - (1 2 3)

        Not sure this helps, but the only time I've seen waitpid return -1 (aka 255) when it should have returned something useful was when I was mixing it with perl's builtin backticks/system()/rx() which reap children themselves (i.e. one starts reaping children it's not responsible for).