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

Patrik Flykt Patrik.Flykt at linux.intel.com
Thu Jun 26 05:00:06 PDT 2014


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?


Cheers,

	Patrik



More information about the systemd-devel mailing list