I found the problem.  Sort of.

The usage of a static number for the STATUS_FD and LISTEN_FDs seem to be
causing problems.  I can't define exactly how its doing it, but those
descriptors are being redefined somehow, and the data ends up being sent
to the wrong place.  It also looks like there might be some times when
wrong data is sent to the right place.  I think I saw an instance of a
syslog() passing its data to what I assume it thought its syslog socket
was on fd3, which had already been dup2()'d over.

I changed STATUS_FD and LISTEN_FD to 1000 and 1001, respectively, and
that seemed to solve the problem, but it's not a very good solution,
IMHO.  You need to make sure that your dup2()s are not closing fds that
other parts of your program are still using.  And I don't think that
it's possible by using #defines.  I was pretty certain that fds 1000 and
1001 were not being used, but I don't think that there's anyway you can
know that beforehand.  There needs to be a totally different way to pass
the correct file descriptor between processes, because it needs to be
dynamic.  An envvar, perhaps?

-Bitt

Reply via email to