Question about rad_fork
Garber, Neal
Neal.Garber at energyeast.com
Wed Jan 31 15:12:15 CET 2007
While reviewing rad_fork, as part of an enhancement I'm working on, I
found something questionable. After the call to fork, it tests if
child_pid != 0 (to see if the parent is the process executing, I
presume). If true, then, the child_pid is added to the thread pool and
the thread pool mutex is unlocked. However, if the fork failed, -1 is
returned (and stored in child_pid), which I believe will then be added
to the thread pool (because -1 != 0 and there isn't an explicit test for
fork success/failure). Shouldn't there be a test for fork success
(child_pid > 0) before adding to the thread pool? Perhaps this isn't a
big deal because fork probably doesn't fail that often. But, it isn't
clear to me what would happen in reap_children when it calls waitpid
with -1 as this tells waitpid to return status for any child.
Am I missing something? If not, and you want me to submit a bug report
with the minor code change, let me know..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20070131/d291fc68/attachment.html>
More information about the Freeradius-Devel
mailing list