X-Git-Url: https://git.decadent.org.uk/gitweb/?p=odhcp6c.git;a=blobdiff_plain;f=src%2Fodhcp6c.c;h=9f7019da5a1ceb935f16a0476baa3ae635dbc224;hp=061cb42a607f7ac8e94f477c2eb0e6d466431f7d;hb=7b3e29a4ff20f1b1e91fa65b5a0631462dbee06d;hpb=2ce1c6dcec4afa1c7bd16e79cfcae247b88450ec diff --git a/src/odhcp6c.c b/src/odhcp6c.c index 061cb42..9f7019d 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -409,10 +409,12 @@ void odhcp6c_update_entry_safe(enum odhcp6c_state state, struct odhcp6c_entry *n new->valid = safe; if (new->valid > 0) { - if (x) - *x = *new; - else + if (x) { + x->valid = new->valid; + x->preferred = new->preferred; + } else { odhcp6c_add_state(state, new, sizeof(*new)); + } } else if (x) { odhcp6c_remove_state(state, (x - start) * sizeof(*x), sizeof(*x)); }