[systemd-devel] [PATCH 5/8] sd-dhcp6-lease: Add helper function to compute remaining expiry time

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Jun 26 05:07:40 PDT 2014


On Thu, Jun 26, 2014 at 03:00:06PM +0300, Patrik Flykt wrote:
> On Thu, 2014-06-26 at 13:01 +0200, Zbigniew Jędrzejewski-Szmek wrote:
> > > +        *expire = 0;
> > > +
> > > +        LIST_FOREACH(addresses, addr, ia->addresses) {
> > > +                t = be32toh(addr->lifetime_valid);
> > > +                if (*expire < t)
> > > +                        *expire = t;
> > > +        }
> > > +
> > > +        t = be32toh(ia->lifetime_t2);
> > > +        if (t > *expire)
> > > +                return -EINVAL;
> > > +
> > > +        *expire -= t;
> > > +
> > > +        return 0;
> > Please use a temporary variable so that *expire is only written to
> > when 0 is returned.
> 
> And fixed as well. Any more comments or shall I send an updated version?
No comments, the rest looks great, as usual. I think you can push it.

Zbyszek


More information about the systemd-devel mailing list