> >  > We're all building those grass runways on the island.
 > > 
 > > Does that mean the current structure is necessary?
 > 
 > I based it on the other code I'd seen.  I'll admit that I don't really
 > fully understand the private contract interfaces.
 > 
 > I spent some time testing this, and I found that I don't need to do
 > that at all.  Both the contract_latest() and the contract_abandon_id()
 > work fine if done after the child has exited.  I used 'ps -o ctid' to
 > show that I still had a separate contract for dhcpagent, and 'ctstat'
 > to show that the contract parameters were all the same.

Great, the new code is what I had in mind.

 > My update for this review comment (simplifying the code) is:
 > 
 > diff -r 14c9daa6faaf usr/src/lib/libdhcpagent/common/dhcpagent_util.c
 > --- a/usr/src/lib/libdhcpagent/common/dhcpagent_util.c       Fri May 15 
 > 08:41:49 2009 -0400
 > +++ b/usr/src/lib/libdhcpagent/common/dhcpagent_util.c       Fri May 15 
 > 09:52:38 2009 -0400
 > @@ -152,10 +152,6 @@
 >  
 >      childpid = fork();
 >  
 > -    /* parent needs contract id */
 > -    if (childpid != 0 && childpid != (pid_t)-1 &&
 > -        contract_latest(&ct) == -1)
 > -            ct = -1;
 >      (void) ct_tmpl_clear(ctfd);
 >      (void) close(ctfd);
 >  
 > @@ -173,7 +169,8 @@
 >  
 >      /* wait for the daemon to run and then abandon the contract */
 >      (void) waitpid(childpid, NULL, 0);
 > -    if (ct != -1)
 > +
 > +    if (contract_latest(&ct) != -1)
 >              (void) contract_abandon_id(ct);
 >  
 >      while ((timeout != -1) && (time(NULL) - start_time < timeout)) {

-- 
meem

Reply via email to