From d471a57aa864e620e5b8033f9029da559161c49e Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 9 Feb 2020 13:58:39 -0800 Subject: [PATCH] Convert call sites to the proper method for setting the name. Signed-off-by: Richard Cochran Reviewed-by: Jacob Keller --- clock.c | 5 +++-- config.c | 2 +- pmc_common.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clock.c b/clock.c index 3895d09..159fcb2 100644 --- a/clock.c +++ b/clock.c @@ -850,6 +850,7 @@ struct clock *clock_create(enum clock_type type, struct config *config, int fadj = 0, max_adj = 0, sw_ts; int phc_index, required_modes = 0; struct clock *c = &the_clock; + const char *uds_ifname; struct port *p; unsigned char oui[OUI_LEN]; char phc[32], *tmp; @@ -999,8 +1000,8 @@ struct clock *clock_create(enum clock_type type, struct config *config, } /* Configure the UDS. */ - snprintf(udsif->name, sizeof(udsif->name), "%s", - config_get_string(config, NULL, "uds_address")); + uds_ifname = config_get_string(config, NULL, "uds_address"); + interface_set_name(udsif, uds_ifname); if (config_set_section_int(config, interface_name(udsif), "announceReceiptTimeout", 0)) { return NULL; diff --git a/config.c b/config.c index c30f6bc..717ee65 100644 --- a/config.c +++ b/config.c @@ -835,7 +835,7 @@ struct interface *config_create_interface(const char *name, struct config *cfg) return NULL; } - strncpy(iface->name, name, MAX_IFNAME_SIZE); + interface_set_name(iface, name); STAILQ_INSERT_TAIL(&cfg->interfaces, iface, list); cfg->n_interfaces++; diff --git a/pmc_common.c b/pmc_common.c index 6bdaa94..41181fb 100644 --- a/pmc_common.c +++ b/pmc_common.c @@ -350,7 +350,7 @@ struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type, goto failed; } - strncpy(iface.name, iface_name, MAX_IFNAME_SIZE); + interface_set_name(&iface, iface_name); interface_ensure_tslabel(&iface); if (transport_open(pmc->transport, &iface,