SIGCHLD race condition?

mouring at mouring at
Thu Oct 4 04:47:59 EST 2001

On Wed, 3 Oct 2001, Nicolas Williams wrote:

> No, Paul meant to open a pipe when there are no child fildes left to
> select for and all you have to do is wait for client input or the child
> to die -- since select() can't do the waiting, the next best thing is
> for the SIGCHLD handler to write into this pipe whose read end you can
> select() for.
> It's a neat trick. SIGCHLD arrives and the handler reaps the child and
> writes a byte to this place holder pipe, then, when the select() loop is
> entered you come out because there's that byte in the pipe, you check
> the child terminated variable and you exit. No more race condition.

Neat trick, but I've seen scp terminate with a SIGCHLD before the pipe was

I guess I'd have to see the code since I get a feeling we could lose data
on non-interactive session with this trick.  I'd rather track down what C
code is holding the offending file descriptor past's the due date and
rework the code.  I'm not too much a fan of repeating the last 'scp
missing data' thread.

But I'd be damned if I can find it.  <frown>

- Ben

More information about the openssh-unix-dev mailing list