From: Georg Sauthoff Date: Fri, 24 Nov 2023 19:06:06 +0000 (+0100) Subject: client: translate dot into the short hostname X-Git-Tag: 1.0.18~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8955080cb5ff8e24479cc6638d420ca9c0d9817;p=thirdparty%2Flldpd.git client: translate dot into the short hostname as documented in lldpcli(8): configure system hostname name Override system hostname with the provided value. By default, the system name is the FQDN found from the resolved value of uname -n. As a special value, use "." (dot) to use the short hostname instead of a FQDN. --- diff --git a/src/client/conf-system.c b/src/client/conf-system.c index 554f6fc2..57a62f85 100644 --- a/src/client/conf-system.c +++ b/src/client/conf-system.c @@ -205,6 +205,9 @@ cmd_hostname(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_env *env, lldpctl_atom_dec_ref(config); return 0; } + char *c = strchr(un.nodename, '.'); + if (c) + *c = 0; value = un.nodename; } if (lldpctl_atom_set_str(config, lldpctl_k_config_hostname, value) == NULL) {